Quantcast
Viewing latest article 2
Browse Latest Browse All 4

Configure Postfix/Sendmail for PHP mail() in Ubuntu

Actually configure Postfix or Sendmail for PHP mail() is the same. Both of them run the /usr/sbin/sendmail binary. It is quite confusing if we just look at the name of the binary but this is what Postfix did.

For more information, take a look at the Postfix Manual – sendmail.

For the PHP setting, open the /etc/php5/apache2/php.ini and configure the sendmail_path.
php.ini

; For Unix only.  You may supply arguments as well (default: "sendmail -t -i").
; http://php.net/sendmail-path
sendmail_path = "/usr/sbin/sendmail -t -i"

 

Save the file and restart the Apache server.

Try testing the PHP mail() function by the following command. Thanks amitbhatia1. =)

echo testing | mail -s Bla myemail@somewhere.com

 

If you need to send with attachment. you can refer to this post.
PHP – Send Attachment with PHP mail()

Done =)

Reference: Using the mail() function in php with postfix on linux


Filed under: PHP, SMTP Tagged: PHP, Postaday2011, Postfix, Sendmail Image may be NSFW.
Clik here to view.
Image may be NSFW.
Clik here to view.

Viewing latest article 2
Browse Latest Browse All 4

Trending Articles