PDA

View Full Version : [ubuntu] Sendmail configuration for PHP mail function



Hoogoo
October 19th, 2009, 12:52 PM
Hello, I 've installed ubuntu,apache,php,... and i need some solution how to configure sendmail to make php "mail" function work. Any ideas?

I mean what else to install and how to configure it.

Thak you, Hoogoo

Hoogoo
October 19th, 2009, 02:39 PM
Looks like my topic is little bit dead?

Anyone?

Bachstelze
October 19th, 2009, 02:44 PM
A full-fledged MTA like Sendmail will probably be largely overkill. Use something like ssmtp instead.

therendus
November 2nd, 2009, 05:01 AM
A full-fledged MTA like Sendmail will probably be largely overkill. Use something like ssmtp instead.

ssmtp is not good for php since it stalls the execution while connecting to the remote smtp server.

After reading an endless list of 'useful' solutions here's how mine looked eventually:

Install heirloom-mailx
sudo aptitude install heirloom-mailx

Configure it
/etc/nail.rc:
set smtp=mail.yourdomain.com (example)
...smtp-auth-user
...smtp-auth-password
( see file://localhost/usr/share/doc/heirloom-mailx/heirloom-mailx.1.html#18 for details )
optional:
set hostname=nameyouwanttoapearassource.host
Configure php
In the valid php.ini (make sure you edit the correct one for cli and apache mods)
sendmail_path = /usr/bin/mailx -t


You should now be able to use the mail() function with no stalling of the script (and receiving the mail).

* Make sure you include the From: field in your additional headers in the function call or there are chances a stupid and "informative"
smtp-server: 451 Temporary local problem - please try later
error would appear.