How to set Debian Linux default outgoing mail/sendmail application/script?
I'm unfamiliar with Linux, but I'm trying to send mail from PHP. Via SSH, I've found my server's sendmail
and mail
functions to be incapable of sendin开发者_Go百科g mail through SMTP. But, I've had success with nc
(Netcat) and telnet
. Is there a way to switch a server's default mail sending application? E.g. from sendmail
or mail
to nc
or telnet
?
What's in your php.ini file under sendmail_path? (Probably at /etc/php5/apache2/php.ini)
eg:
sendmail_path = /usr/sbin/sendmail
You need this to point into the correct location for your sendmail for mail() to work
Have you tried a PHP library for sending mail, like PHPMailer or Swift Mailer, and send mail via SMTP and not via the mail()
function?
Also, using those libraries you will be able to send more powerful mails (html, attachments) a lot more easily.
And also, and this is what you were looking for (I think), you may take a look to sendmail_path configuration option of php to specify your mail sending application command line (seems you can put some parameters to your command).
edit: added info about sendmail_path
精彩评论