PHP Mail headers

Post November 2nd, 2009, 10:32 am

I have the following mail headers:

Code: [ Download ] [ Select ]
$headers = "MIME-Version: 1.0\n";
  $headers .= "Content-type: text/html; charset=iso-8859-1\n";
  $headers .= "X-mailer: php\n";
  $headers .= "From: \"{$from_name}\" <{$from_email}>\n";
  $headers .= "Return-Path: {$from_email}\n";
  1. $headers = "MIME-Version: 1.0\n";
  2.   $headers .= "Content-type: text/html; charset=iso-8859-1\n";
  3.   $headers .= "X-mailer: php\n";
  4.   $headers .= "From: \"{$from_name}\" <{$from_email}>\n";
  5.   $headers .= "Return-Path: {$from_email}\n";


And these mails are being picked up as spam ... What else do I need to add to fix this issue?
RewriteEngine On

RewriteRule ^(awesome|excellent|extraordinary)$ RT
  • Anonymous
  • Bot
  • No Avatar
  • Joined: 25 Feb 2008
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post November 2nd, 2009, 10:32 am

  • ATNO/TW
  • Super Moderator
  • Super Moderator
  • User avatar
  • Joined: May 28, 2003
  • Posts: 22502
  • Loc: Pittsburgh PA
  • Status: Offline

Post November 2nd, 2009, 11:08 am

Are you getting NDR's? If so is the NDR "smtp;550 5.6.0 Lone CR or LF in headers"?

If it is, check out see RFC2822 section 2.2.
http://www.rfc-archive.org/getrfc.php?rfc=2822

Quote:
Header fields are lines composed of a field name, followed by a colon
(":"), followed by a field body, and terminated by CRLF. A field
name MUST be composed of printable US-ASCII characters (i.e.,
characters that have values between 33 and 126, inclusive), except
colon. A field body may be composed of any US-ASCII characters,
except for CR and LF. However, a field body may contain CRLF when
used in header "folding" and "unfolding" as described in section
2.2.3. All field bodies MUST conform to the syntax described in
sections 3 and 4 of this standard.


Also in php mail, to, subject and message are required. Other headers are optional
http://php.net/manual/en/function.mail.php

Also looking at a couple of the examples, the carriage return is concatenated . I don't know if that makes a difference.
PHP Code: [ Download ] [ Select ]
// To send HTML mail, the Content-type header must be set
$headers  = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
 
  1. // To send HTML mail, the Content-type header must be set
  2. $headers  = 'MIME-Version: 1.0' . "\r\n";
  3. $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
  4.  
"The web is a dominatrix. Every where I turn, I see little buttons ordering me to Submit."
Play sports pools and discuss sports topics at Boasting Rights Sports Forum
Get paid to write articles - www.associatedcontent.com
  • joebert
  • Weathered
  • Genius
  • User avatar
  • Joined: Feb 10, 2004
  • Posts: 11886
  • Loc: Clearwater, FL
  • Status: Offline

Post November 2nd, 2009, 2:01 pm

Reminding your users to add an exception for mail from you is all you can really do to keep from being dumped in their spam bin. If there were some magical header you could always add/omit to keep yourself out of the spam bin that would pretty much defeat the entire purpose of spam filters in the first place.
Why yes, yes I am.

Post November 2nd, 2009, 2:22 pm

Yeah joebert I hear you. What really sucks is that my client doesn't ... These people have absolutely no understanding of the internet. It's difficult for me to try and get it through to them that it just isn't that simple. hehe.

@atno: Thanks for the link, I can't view that page (RFC) but I found it by searching google.
RewriteEngine On

RewriteRule ^(awesome|excellent|extraordinary)$ RT

Post November 3rd, 2009, 2:09 am

Sorry that I wasted your time guys ... I forgot to add the semi-colon after each of the lines ... What a daft moment ... Thanks anyway guys.
RewriteEngine On

RewriteRule ^(awesome|excellent|extraordinary)$ RT
  • joebert
  • Weathered
  • Genius
  • User avatar
  • Joined: Feb 10, 2004
  • Posts: 11886
  • Loc: Clearwater, FL
  • Status: Offline

Post November 3rd, 2009, 11:29 am

A syntax error actually lets the emails get sent instead of giving you an notice ? :scratchhead:

Wow, imagine if someone missed a single semi-colon on a mailing list with a sizable number of recipients. Every provider on the Internet would end up flagging you.
Why yes, yes I am.

Post November 4th, 2009, 12:24 am

Yeah, the funny thing is, these mails were getting sent off our dedicated server at work ... our email addresses on ther domains on the same server were getting it fine, but then even yahoo and hotmail were receiving the mails just fine, but the client wasn't receiving the mails. It's a really strange situation ... I really don't understand how email really works.
RewriteEngine On

RewriteRule ^(awesome|excellent|extraordinary)$ RT

Post Information

  • Total Posts in this topic: 7 posts
  • Users browsing this forum: No registered users and 347 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
 

© Unmelted Enterprises 1998-2009. Driven by phpBB © 2001-2009 phpBB Group.