Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

Help! Magento email arriving as spam! 
 
awillshire
Jr. Member
 
Total Posts:  14
Joined:  2008-07-21
 

Hello,

I am noticing that some (but not all) of my order related Magento emails are being flagged as spam in the subject line, when they arrive at the recipient’s inbox.  The strange thing is, the same type of email (ie: invoice) may or may not be flagged as spam, based on no related rules that I can see.  Sometimes it’s spam, sometimes it’s not.  These are all test orders, and the customer has the same name at all times. 

Has anybody experienced this & worked out a solution?

Thanks,
Andrew.

 
Magento Community Magento Community
Magento Community
Magento Community
 
ldjones
Jr. Member
 
Total Posts:  23
Joined:  2008-04-03
 

I am having the same problem with my transactional emails.  Here is a portion of the email header regarding the spam status:

X-Spam-Level: ******
X-Spam-Status: Yes, score=6.8 required=5.0 tests=HTML_IMAGE_ONLY_20,
HTML_MESSAGE,MIME_HTML_ONLY,MIME_QP_LONG_LINE,MSGID_FROM_MTA_HEADER
autolearn=no version=3.2.3
X-Spam-Report:
* 1.8 HTML_IMAGE_ONLY_20 BODY: HTML: images with 1600-2000 bytes of words
* 0.0 HTML_MESSAGE BODY: HTML included in message
* 1.7 MIME_HTML_ONLY BODY: Message only has text/html MIME parts
* 1.8 MIME_QP_LONG_LINE RAW: Quoted-printable line longer than 76 chars
* 1.5 MSGID_FROM_MTA_HEADER Message-Id was added by a relay

Does anyone know about “MIME_QP_LONG_LINE”?  None of my lines that I can see are longer than 76 characters.

Also, does anyone know about “MSGID_FROM_MTA_HEADER”?  Is Magento supposed to put this in when it creates the actual email that is sent?

And one more...how do I create a transactional email that has both html and plain text?

Thanks, Larry

 
Magento Community Magento Community
Magento Community
Magento Community
 
Roland Quast
Jr. Member
 
Total Posts:  19
Joined:  2008-08-27
 

Possible causes:

1. Do you have an SPF record for the domain name of your return email address? The SPF record needs to include the internet address that magento is running on. For more info on configuring SPF records, go to http://www.openspf.org/

2. Remove all images from the emails that are sent out (sometimes embedded images particularly raise the spam meter).

3. Make sure the sending IP address of the mails (most probably your magento server’s ip address) isn’t on a spam blacklist.

 
Magento Community Magento Community
Magento Community
Magento Community
 
ldjones
Jr. Member
 
Total Posts:  23
Joined:  2008-04-03
 

Thanks for the reply.

1. I do have a valid SPF record--double checked at http://www.openspf.org/.
2. I did remove all of my images and got the score down to 4.9.  Although, I would like to be lower than that to ensure that I get through all email servers.
3. My domain is not an any blacklist.

Still some questions:
1. How or where does the MSGID_FROM_MTA_HEADER in the email header get set?
2. How do I get Magento to have both an HTML and text message in the same email?

Thanks, Larry

 
Magento Community Magento Community
Magento Community
Magento Community
 
Roland Quast
Jr. Member
 
Total Posts:  19
Joined:  2008-08-27
 
ldjones - 29 August 2008 08:48 PM

Thanks for the reply.

1. I do have a valid SPF record--double checked at http://www.openspf.org/.
2. I did remove all of my images and got the score down to 4.9.  Although, I would like to be lower than that to ensure that I get through all email servers.
3. My domain is not an any blacklist.

Still some questions:
1. How or where does the MSGID_FROM_MTA_HEADER in the email header get set?
2. How do I get Magento to have both an HTML and text message in the same email?

Thanks, Larry

The MSGID is set by your SMTP server. This could be sendmail or exim or whatever your default outgoing mail server is set to on your machine. You may be able to tweak the msgid by modifying the configuration files of your MTA (sendmail or whatever you are running on your magento box).

 
Magento Community Magento Community
Magento Community
Magento Community
 
Roland Quast
Jr. Member
 
Total Posts:  19
Joined:  2008-08-27
 
ldjones - 29 August 2008 08:48 PM

Thanks for the reply.

Still some questions:
1. How or where does the MSGID_FROM_MTA_HEADER in the email header get set?
2. How do I get Magento to have both an HTML and text message in the same email?

Thanks, Larry

Oh, the HTML and text message… I don’t know… since the email templates are stored as HTML files, it may just automatically set the mime type as HTML. I think your best bet is to go through the code and find out where the files are that include those html email templates. Then trace your way back until you find the email object and what methods it calls (eg, if it sets mime headers to something other than Content-type: text/plain) and modify it?

 
Magento Community Magento Community
Magento Community
Magento Community
 
awillshire
Jr. Member
 
Total Posts:  14
Joined:  2008-07-21
 

Hi Roland,

Thank you very much for your help with this, much appreciated!

All the best,
Andrew.

 
Magento Community Magento Community
Magento Community
Magento Community
 
ldjones
Jr. Member
 
Total Posts:  23
Joined:  2008-04-03
 

Finally, I got an answer from my web hosting support (after prematurely closing the first ticket, then forgetting to put the second ticket into the escalation queue).

They came back and said that the MSGID is set from the mail client--not the server.

So, does anyone know how this is to be set from Magento?

Thanks, Larry

 
Magento Community Magento Community
Magento Community
Magento Community
 
Roland Quast
Jr. Member
 
Total Posts:  19
Joined:  2008-08-27
 

You can either specify the Message-Id by modifying the php mail function’s headers http://au2.php.net/manual/en/function.mail.php which I grepped the magento code and I don’t think it does it.

If the Message-Id isnt set by php, sometimes (not always) its set by the MTA. You can modify the default message ID for sendmail for instance by modifying your php.ini file http://www.linuxquestions.org/questions/linux-server-73/problem-with-the-message-id-of-outgoing-emails-missing-domain-658452/

ldjones - 10 September 2008 04:02 AM

Finally, I got an answer from my web hosting support (after prematurely closing the first ticket, then forgetting to put the second ticket into the escalation queue).

They came back and said that the MSGID is set from the mail client--not the server.

So, does anyone know how this is to be set from Magento?

Thanks, Larry

 
Magento Community Magento Community
Magento Community
Magento Community
 
DennisR
Jr. Member
 
Total Posts:  3
Joined:  2009-08-11
 
ldjones - 21 August 2008 09:06 PM

Does anyone know about “MIME_QP_LONG_LINE”?  None of my lines that I can see are longer than 76 characters.

This problem was a bit tricky. Finally i found the responsible code. Magento renders the mail-content with the help of the class Zend_Mime. Within this class the length of an line is defined as 200 (it becomes 201 with quotedprintable because of an line-end-char). This is not correct for mails encoded “quotedprintable”. So i simply changed the linelength to get the rfc-compatible length of 76 chars.

You have to change only one single number-value in one php file. Copy for future updates with Magento Connect the file /app/code/core/Zend/Mime.php to /app/code/local/Zend/Mime.php. Now change the following line of code (line 41 in 1.3.2.2):

const LINELENGTH 200;
to
const LINELENGTH 75;
I don’t know, if there are any consequences of this change for other functions of Magento - but i use it for an active shop and have no problems so far.
ldjones - 21 August 2008 09:06 PM

And one more...how do I create a transactional email that has both html and plain text?

With the help of another little hack it is possible to send multipart/alternative mails with Magento, see www.magentocommerce.com/boards/viewthread/25075/#t156959 - you have to create a text version of every mail your shop uses, an example can be found in the linked thread too.

Dennis

 
Magento Community Magento Community
Magento Community
Magento Community
 
Joshua Barrie
Member
 
Total Posts:  52
Joined:  2009-01-02
 

Thanks Dennis,

This enabled the customers to recieve confirmation emails when they placed the order. Though if I type in the “add comments” section to the order, click ‘notify customer’, magento states that the customer is notified when emails have not been recieved.

Also the ADMINISTATOR is not recieving emails when a new order has been placed.  Any reason for this? Im pretty sure that the admin should automatically recieve emails when new orders have been placed. Other than that, at least the order confirmation finally now sends!

Regards,

 
Magento Community Magento Community
Magento Community
Magento Community
 
Adjustware
Guru
 
Avatar
Total Posts:  654
Joined:  2009-05-11
 
Joshua Barrie - 23 August 2009 09:56 PM

Also the ADMINISTATOR is not recieving emails when a new order has been placed.  Any reason for this?

Hi, surprisingly it is not available out of the box smile

You need to add your email as CC or BCC to a “order confirmation” email, see
Sales Emails > Order > Send Order Email Copy To

 
Magento Community Magento Community
Magento Community
Magento Community
 
nickweisser
Sr. Member
 
Avatar
Total Posts:  218
Joined:  2007-09-03
Zurich, Switzerland
 
DennisR - 11 August 2009 04:27 AM

This problem was a bit tricky. Finally i found the responsible code. Magento renders the mail-content with the help of the class Zend_Mime. Within this class the length of an line is defined as 200 (it becomes 201 with quotedprintable because of an line-end-char). This is not correct for mails encoded “quotedprintable”. So i simply changed the linelength to get the rfc-compatible length of 76 chars.

Thanks for this solution, Dennis!

I think this should be filed as a bug, but as it’s part of the Zend framework I’m not sure where it should be filed?

 
Magento Community Magento Community
Magento Community
Magento Community
 
nickweisser
Sr. Member
 
Avatar
Total Posts:  218
Joined:  2007-09-03
Zurich, Switzerland
 

Just for reference…

Content analysis details:   (4.5 points4.0 required)

 
pts rule name              description
---- ---------------------- --------------------------------------------------
-
0.0 SPF_HELO_PASS          SPFHELO matches SPF record
-0.0 SPF_PASS               SPFsender matches SPF record
 0.0 HTML_MESSAGE           BODY
HTML included in message
 1.7 MIME_HTML_ONLY         BODY
Message only has text/html MIME parts
 1.8 MIME_QP_LONG_LINE      RAW
Quoted-printable line longer than 76 chars
 1.1 HTML_MIME_NO_HTML_TAG  HTML
-only messagebut there is no HTML tag
 0.0 RDNS_NONE              Delivered to trusted network by a host with no rDNS
 
Magento Community Magento Community
Magento Community
Magento Community
 
burguefab
Jr. Member
 
Total Posts:  10
Joined:  2010-01-19
 

Same for me

pts rule name description
--------------------------------
0.0 MISSING_MID Missing Message-Id: header
2.5 HTML_IMAGE_ONLY_28 BODY: HTML: images with 2400-2800 bytes of words
0.0 HTML_MESSAGE BODY: HTML included in message
2.3 MIME_HTML_ONLY BODY: Message only has text/html MIME parts
2.5 MIME_QP_LONG_LINE RAW: Quoted-printable line longer than 76 chars
0.1 RDNS_NONE Delivered to trusted network by a host with no rDNS
1.7 HTML_MIME_NO_HTML_TAG HTML-only message, but there is no HTML tag
0.2 SARE_SUB_ENC_UTF8 Message uses character set often used in spam

I found some mime.php in my magento (but not the first listed in the post.
I made the change from 200 to 75 to the following mime: /app/code/core/Zend
Now I need to take off images from email
But what about the HTML TAGS ?

 
Magento Community Magento Community
Magento Community
Magento Community
 
NETZKOLLEKTIV
Member
 
Avatar
Total Posts:  35
Joined:  2010-05-06
Erlangen, Germany
 

Use our extension NETZKOLLEKTIV SpamFix to reduce spam score of Magento E-Mails dramatically!

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top