Table of Contents
Sendmail - the default mailing system on Linux Computers
Php's mail() function uses sendmail. However what if sendmail is broken, or php's mail() is broken.
Here is how to send an email using sendmail on the command line: /usr/lib/sendmail email@address type in message then and type some more To send email press CTRL+D
There are a host of options including debug etc.
Relaying Unix/ Linux PHP mail() via an external smtp server ->
If your Web Server IP is listed as SPAM then you need to use a proper mailserver to “relay” your emails. We dont want to have to go writing TONS of code for PHP to replace the mail() function. Here's how you can tell sendmail to relay via a SMTP server :-
Setup your own sendmail.cf (config) file. Here is the Important Line: DSmail.kartbuilding.net O QueueDirectory=/var/tmp
DS - obviously - set your SMTP server Here. Also the QueueDirectory has to be set to something sendmail can write to. The quickest to spool the mails is /var/tmp
In order to get PHP to use your sendmail.cf (config), we'll use a htaccess file. Place this in your .htaccess file: php_value mail.force_extra_parameters “-C /path_to_your/yourconfig.cf”
Do a phpinfo() in your Directory to check that the extra_parameters register. Well - you should hopefully be off then.
Proper Domain Name
If you are finding that your emails are been bounced back saying localhost.localdomain is not valid etc. then your email sendmail is not setup correctly. A quick and dirty solution to this is to add/ replace the following line into yourconfig.cf or sendmail.cf: # my official domain name # … define this only if sendmail cannot automatically determine your domain Djmail.domain.com Your emails will be send as email@example.com instead of firstname.lastname@example.org.
Info. found at: http://docs.hp.com/en/32650-90906/ch10s07.html