Do I need a SMTP server in using the PHP's mail() function?
p.s. I am on a share hosting account, so I cannot install a SMTP server and they don't provide that.
PHP's mail() function doesn't need SMTP. It uses a program called sendmail which is generally available on Unix/Linux platforms by default and most web hosts provides this facility for no extra charge.
PHP on Linux servers relies on a local MTA for the mail() function.
PHP on Windows can be configured to use whatever SMTP server you like.
PEAR::Mail allows you to set which SMTP server you want to use. http://pear.php.net/manual/en/package.mail.mail.intro.php
With the first parameter as 'smtp', the second param accepts details. http://pear.php.net/manual/en/package.mail.mail.factory.php
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With