Dave M G wrote: > PHP List, > > I run a few various social groups, and with each one I keep in contact > with members by emailing them short newsletters. > > All my user information is stored in a MySQL database. I use PHP to > get the relevant contact information, and use the mail() command to > send out the emails one by one, so that each email is a little > personalized. > > I've used this system for many years now with no problems up until now. > > What has changed, though, is that in recent years, anti-spam measures > have become so aggressive that more and more people who sign up to my > groups complain that they never receive the emails. > > A lot of the times, after they alert me to the issue, I can educate > them a little about the anti-spam measures they most likely have on > their system, and walk them through how to make it so that my > newsletters go through. > > However, that is clearly not enough. > > To shorten a story that has already gone on a little long, it's come > to my attention that part of the reason that my emails may not be > getting through are because the headers are not sufficiently > legitimate looking enough to bypass some server side anti-spam > measures. Things like "Return-Path" are being set so that they look > like they come from an email address that begins with the username > "nobody". > > If possible, can anyone help me with creating the PHP code that will > make an email as legitimate as it can be? I know I can't totally > prevent my email from being marked as spam (after all, if it were > possible, all the spammers would do it). But as much as I can prevent > anti-spam measures getting a false positive when testing my email, the > better. > > Here is the PHP code I currently use (trimmed for clarity): > > while ( $member = mysql_fetch_row($mysqlResult) ) > { > $subscriber = $member[0]; > $email = $member[1]; > $subject = "Report for " . date('l jS F Y'); > $mailContent = "This is an email to " . $subscriber . " at " . $email > . "."; > $fromAddress = "info@xxxxxxxxxx" > mail($email, $subject, $mailContent, $fromAddress); > } > > > And here is what the headers for an email from that code looks like: > > -Account-Key: account5 > X-UIDL: UID497-1152485402 > X-Mozilla-Status: 0001 > X-Mozilla-Status2: 00000000 > Return-path: <nobody@xxxxxxxxxxxxxxxxxxxxxxxxxxx> > Envelope-to: info@xxxxxxxxxx > Delivery-date: Sun, 03 Sep 2006 14:22:42 -0700 > Received: from nobody by server.myhostingservice.com with local (Exim > 4.52) > id 1GJzQQ-0005pA-Mz > for info@xxxxxxxxxx; Sun, 03 Sep 2006 14:22:42 -0700 > To: member@xxxxxxxxxxxxxx > Subject: Report for Monday 4th September 2006 > From: info@xxxxxxxxxx > Message-Id: <E1GJzQQ-0005pA-Mz@xxxxxxxxxxxxxxxxxxxxxxxxxxx> > Date: Sun, 03 Sep 2006 14:22:42 -0700 > > Which parts are key to change, and how? > > Thank you for any and all advice. > > -- > Dave M G > Ubuntu 6.06 LTS > Kernel 2.6.17.7 > Pentium D Dual Core Processor > PHP 5, MySQL 5, Apache 2 > If it is sendmail it would be the -f parameter to set the Envelope-From address. ie... php.ini would have 'sendmail_path = /pathto/sendmail -f me@xxxxxxxxxxx'. Since PHP 4.0.5 you can also set the additional_parameter like php.net/manual/function.mail.php (the example there is specifically for this use.) What you actually should be doing: install SpamAssasin on your workstation and run the message through it in test mode... Figure out what rules get hit and work to resolve those. Run it like `spamassassin -t < message_with_headers` So, you'd copy your complete message (as you have above) into message_with_headers and run it through SA. Maybe SA is giving you points for things like too many exclamations, certain ratio of HTML... I doubt that having a return-path of 'nobody' is the lowest-hanging fruit you can pick up here to make yourself look less spammy. Also make sure the sending mail server isn't listed in any blacklists (yahoo for RBL lookup tool to check.) Travis Doherty -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php