Monday, May 17, 2010

PHP broken email

There are cases when an email might end up showing the headers inside the email's body. This means that headers are usually.

We had a big headache with a PHP project lately as all the emails were broken ("butchered" as someone said).

Here is how a test the email looked like:

MIME-Version: 1.0
Content-type: text/html; charset=utf-8
Message-Id: <...........>
Date: Mon, 17 May 2010 10:52:35 +0300 (EEST)
From: root@snow.zzzptoid.com (root)




Yes, a simple HTML email test
Now we took a look at the raw email and here is what we saw:
Received: (qmail 9464 invoked from network); 17 May 2010 07:51:47 -0000
Received: from unknown (HELO m1pismtp01-011.prod.mesa1.secureserver.net) ([10.8.12.11])
(envelope-sender )
by p3plsmtp03-04.prod.phx3.secureserver.net (qmail-1.03) with SMTP
for ; 17 May 2010 07:51:47 -0000
X-IronPort-Anti-Spam-Result: AqoFAAiS8EtZLcluX2dsb2JhbACRfQEBixsDbB5IvwkEiQ8
Received: from pc110.fx-net.ro (HELO snow.zzzptoid.com) ([89.45.201.120])
by m1pismtp01-011.prod.mesa1.secureserver.net with ESMTP; 17 May 2010 00:51:46 -0700
Received: by snow.zzzptoid.com (Postfix, from userid 0)
id 2FF74F04FB; Mon, 17 May 2010 10:52:35 +0300 (EEST)
To: alex@zzzptoid.com
Subject: Test HTML email
X-PHP-Originating-Script: 0:testSendEmail.php
X-Nonspam: Statistical 50%

MIME-Version: 1.0
Content-type: text/html; charset=utf-8
Message-Id: <...>
Date: Mon, 17 May 2010 10:52:35 +0300 (EEST)
From: root@snow.zzzptoid.com (root)


Yes, a simple HTML email test

Now the problem were those 3 lines :
X-Nonspam: Statistical 50%

MIME-Version: 1.0
There should be no blank line between headers as the email parser will believe that the headers are done and the content is starting.

Where do those extra line coming from? They are added by PHP for any email sent, so we need to remove them; and they are added the wrong way - introducing an unnecessary blank line.

Go to php.ini and set mail.add_x_headers to off:

mail.add_x_headers = Off

Now restart you Apache and let me know if it's working :)

19 comments:

  1. Took me time to read all the comments, but I really enjoyed the article. It proved to be Very helpful to me and I am sure to all the commenters here! It’s always nice when you can not only be informed, but also entertained! Zendable

    ReplyDelete
  2. It changed into wondering if I may want to use this write-taking area regarding my supplementary website, i can member it backing taking region in your website although.notable thanks. Super AntiSpyware Crack

    ReplyDelete
  3. สล็อตแมชชีนไวด์สำหรับผู้เล่นที่กำลังมองหาโปรโมชั่นที่ดีที่สามารถเพิ่มค่าใช้จ่ายของเกมได้มาก คุณได้มาถึงสถานที่ที่เหมาะสม. เพราะเรารวมสล็อตมืออาชีพจำนวนมากเป็นพิเศษ http://www.jokerslot.ninja/ ไม่ว่าจะเป็นโปร ฝาก 29 ผู้เล่นราคาถูก รับ100

    ReplyDelete
  4. หนทางสู่ความร่ำรวยอยู่ข้างหน้า มาเล่นเกมสล็อตออนไลน์กับเราเพราะทางนี้คุณจะต้องมีแต่ได้กับได้เงินเป็นจำนวนมากแน่นอน pgslot มีของแจกมากมายและเป็นเว็บไซต์ยอดนิยมสำหรับนักพนันออนไลน์ โบนัสของเกมสล็อตคือยิ่งใหญ่มากถ้าแตกแล้วนี้คือรวยบอกเลย ทางเข้าเล่นpg https://www.pgslot168game.com/login-pgslot/ พร้อมให้เล่นแล้ว

    ReplyDelete
  5. Congratulations on your article, it was very helpful and successful. be75d04b917a9b659420c5074b03a7a9
    website kurma
    website kurma
    numara onay

    ReplyDelete
  6. Thank you for your explanation, very good content. 3f7f22edae7a49de1e22879307775de1
    altın dedektörü

    ReplyDelete
  7. Directory For PlacesMarch 16, 2023 at 2:38 AM

    The platform also offers a range of advertising and promotional opportunities for businesses looking to reach a wider audience. https://bit.ly/directory-for-places By featuring their place on Directory for Places, businesses can increase their visibility and attract new customers.
    A business guide provides information and guidance on various aspects of business management and ownership.

    ReplyDelete