NYCPHP Meetup

NYPHP.org

[nycphp-talk] Setting up outgoing mail using Linux

Max Gribov max at neuropunks.org
Fri Jun 13 00:25:11 EDT 2008


PaulCheung wrote:
> I am having problems trying to send automated emails using Linux, 
> typically order confirmation emails. I don't know how it is set-up and 
> according to the  manual I read it said "for unix only. You may supply 
> arguments as well (default: 'sendmail -t -i). sendmail_path = sendmail 
> -t -i;
>
You may want to try setting up an email server as a test somewhere else, 
so you can have real access to the logs, and then using phpMailer, since 
it supports real smtp over port 25, with auth and ssl if need be. Access 
to mail log is definetely the first step in troubleshooting this (should 
be something like /var/log/mail.log)

For one project I worked on, email worked correctly only after I set up 
proper reverse resolve for the IP where mail was going out, setting up 
SPF record for the domain with that IP in it (Hi msn/hotmail and co) and 
setting up Domain Keys (Hi yahoo!)

With Domain Keys, at least with Postfix and dk-milter, there was no 
other way to get email signed besides using phpMailer - somehow mail() 
does not interface with postfix right (?) and email was not being signed 
unless the whole SMTP took place over regular port 25/tcp

You should also check the IP address of that server in various black 
lists like spamhaus etc.

Also, Id make sure From: part of the email is a valid address so you can 
receive any bounces.




> This didn't not work. I use 1and1 and they have setup the sendmail and 
> I found the sendmail path is /usr/sbin/sendmail
>
> so I set sendmail_path = '/usr/sbin/sendmail -i -t'; This doesn't work 
> either - below is the snippet of code.
> ================================================================
> $headers = 'X-Mailer: PHP/' . phpversion();
> sendmail_path = '/usr/sbin/sendmail -i -t';
>
> $date = date("Y-m-d");
>
>     $to = "$email1";
>     $subject = "Your Account Number";
>     $message = "Thank you for choosing HANWELL PRODUCTS
>
>
> PLEASE MAKE A CAREFUL NOTE OF THIS INFORMATION AS WITHOUT IT YOU WILL 
> NOT BE ABLE ACCESS YOUR  HANWELL PRODUCTS ACCOUNT
>
> Your USER-ID  is :  $userid
>
> Your PASSWORD is :  $passcode
>
> Your ACCOUNT  is :  $account
>
> This Email was sent on : $account_date
>
> ";
> $from    = "FROM: info at hanwellproducts.com";
>
> echo "The email was sent : $date ";
> mail ($to, $subject, $message, $headers);
> ?>
>
> Can anybody show me what I am doing wrong?
>
> Paul
>
>
>
> _______________________________________________
> New York PHP Community Talk Mailing List
> http://lists.nyphp.org/mailman/listinfo/talk
>
> NYPHPCon 2006 Presentations Online
> http://www.nyphpcon.com
>
> Show Your Participation in New York PHP
> http://www.nyphp.org/show_participation.php




More information about the talk mailing list