|Using PHP's mail function and trying to avoid spam filters|
| 3:04 pm on Jan 20, 2007 (gmt 0)|
I am setting up a basic e-card script on a site, which will use PHP's mail function to send card recipients a text based email with a link to the web page with their card.
I am also trying to avoid being labeled as spam as much as I can.
When sending out the emails, should the from line be from my website, or use the name as email address of the sender? I was thinking if I use the their name and email address that would avoid black lists (assuming the card sender has also sent the recipient regular emails in the past). However, I'm thinking at the same time that might seem somewhat like lying.
Also, I am using shared hosting, and I am looking at the emails the server is sending. They are not coming from my site or my ip address, but from the mail server. Is this as bad as I'm thinking, and might there be anything I can change in the mail function to have it come from my site?
Thanks for any ideas.
| 12:30 pm on Jan 22, 2007 (gmt 0)|
|When sending out the emails, should the from line be from my website, or use the name as email address of the sender? ... However, I'm thinking at the same time that might seem somewhat like lying. |
Well, technically you are lying if you specify the sender's email address, and if the recipient's email system checks for a SPF [openspf.org] record at the supposed sender's host, it will come back negative and the email will probably not be delivered. Therefore, you're probably better off specifying the sender as your website. (Extra publicity that way as well ;) )
|They are not coming from my site or my ip address, but from the mail server. Is this as bad as I'm thinking, and might there be anything I can change in the mail function to have it come from my site? |
I'm not quite sure that I understand. Why would this be a bad thing? There are a couple of things that you need to ensure in order to be more confident of email delivery:
1) Your host's mail server is not blacklisted
2) Your host's mail server has a valid reverse DNS (or PTR) record. (See the tools at DNS Stuff [dnsstuff.com] for details.)
It would also be advantageous if your host could set up SPF [openspf.org] for your domain so that the legitimacy of your emails can be verified.
Then you need to move on to looking at the content of your email and ask yourself if it could be construed as spam by the automated content filters. Take a look at the tests performed by SpamAssassin [spamassassin.apache.org] for pointers on what to avoid.
That's a lot to think about, so good luck! :)