Linode Forum
Linode Community Forums
 FAQFAQ    SearchSearch    MembersMembers      Register Register 
 LoginLogin [ Anonymous ] 
Post new topic  Reply to topic
Author Message
 Post subject: PHP mail() issue
PostPosted: Tue May 18, 2010 12:51 am 
Offline
Senior Member

Joined: Tue Mar 09, 2004 3:52 am
Posts: 106
Posting here as I thought someone here might have seen this behavior...

When sending mail via PHP's mail() function, ~10% of my user's receive the email malformed, consistantly (i.e. not a random issue with mail() but perhaps a configuration issue with mail that is causing certain mail providers to display it incorrectly?)

Here is what these user's are seeing in the body of the email for some reason:

Code:
Reply-To: "Test User" <test@domain.com>

MIME-Version: 1.0

Content-Type: text/plain; charset=UTF-8
Message-Id: <20100374043720.7BFBC2D7DB@mx.example.com>
Date: Tue, 18 May 2010 00:37:20 -0400 (EDT)


And here are the header settings I am passing to mail():

Code:
'From: "Webmaster" <webmaster@example.com>\r\nReply-To: "Test User" <test@domain.com>\r\nMIME-Version: 1.0\r\nContent-Type: text/plain; charset=UTF-8'


Any ideas? Again, most of my user's see the message ok, so I am stumped. Anything I am obviously doing wrong here in the settings, or has anyone encountered this issue before?

Thanks!


Top
   
 Post subject: Solution
PostPosted: Tue May 18, 2010 1:02 am 
Offline
Senior Member

Joined: Tue Mar 09, 2004 3:52 am
Posts: 106
Just in case anyone else is as silly as I am, the issue was with the spacing in the header itself... was using \r\n when I should have simply been using \n. Problem solved!


Top
   
 Post subject:
PostPosted: Tue May 18, 2010 5:40 pm 
Offline
Senior Member

Joined: Fri May 02, 2008 8:44 pm
Posts: 1121
Avoid mail() if you can. It is difficult to secure, not to mention that it causes inconsistent behavior such as what you experienced.

SwiftMailer http://swiftmailer.org/ is much more powerful, and just as easy if not easier to use in your custom scripts. It is also dead easy to transition to something else (Google Apps or external SMTP servers) later on.


Top
   
 Post subject: Thanks!
PostPosted: Tue May 18, 2010 10:30 pm 
Offline
Senior Member

Joined: Tue Mar 09, 2004 3:52 am
Posts: 106
My mail needs are extrememly basic at this point, but will look into this SwiftMailer in the future.

Paul


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic


Who is online

Users browsing this forum: No registered users and 3 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

Search for:
Jump to:  
RSS

Powered by phpBB® Forum Software © phpBB Group