Log in

View Full Version : Mail Subject cause SPAM



rhodarose
05-17-2011, 09:53 AM
I have code for mail subject:



$Mail->Subject = 'Preview/' . $this->csvUploadPaymentDetails[0]['csvfilename'].'/'.date('d-m-Y').'/'.$this->csvUploadPaymentDetails[0]['week_num'];


The problem is the mail was become SPAM, I got this message
Mail delivery failed: returning message to sender. How can I prevent my email become not SPAM?

When my subject is only this: $Mail->Subject = 'Preview'; it works, but I need my subject is
$Mail->Subject = 'Preview/' . $this->csvUploadPaymentDetails[0]['csvfilename'].'/'.date('d-m-Y').'/'.$this->csvUploadPaymentDetails[0]['week_num']; , because I need to have filename,date, and weekno in my subject.

It's my first time to encounter this error.

Thank you..any help is highly appreciated.

traq
05-17-2011, 02:11 PM
are you sure it's being filtered as spam, and not failing for some other reason? for example, what does your variable csvUploadPaymentDetails[0]['csvfilename'] contain? RFC2822 limits the number of characters you can put in an email header (e.g., Subject line) to 998 (and only 78 per line). You might find this (http://tools.ietf.org/html/rfc4096) useful.

If your email is being ID'd as spam, then you need to change the content of your Subject line. it looks like you're putting a filename in your subject now; that seems like it might be suspicious in the eyes of a spam filter. In any case, there are no hard rules about avoiding spam: email clients all do this differently, and are constantly updating their criteria.