|
Problem sending emails with PHP
free accounts like yahoo don't accept them |
londrum
#:3892307
| 6:26 pm on April 14, 2009 (utc 0) |
hello. i've got this script on my site which lets people write some stuff on it and then send it out -- sort of like a "tell a friend" script. and it all works fine. i've tested it out myself (on a gmail account) and i get the emails okay. but if i try and send it to some other free accounts like hotmail or yahoo, then the emails never arrive. the emails don't appear in their spam folders either, so it's not that. does anyone know why some accounts would get them okay, and some don't? are there any headers that you should remember to include, to make the email seem legitimate? the script is set up so the 'from' field is the user's own email address, which he enters himself, but the email obviously originates from my server. would that maybe have something to do with it, do you think?
|
BarryStCyr
#:3892319
| 6:37 pm on April 14, 2009 (utc 0) |
I use a common sender address of tellafriend@example.com This seems to work. Be careful of others using your form for spamming. I only allow 1 receiver's address and make sure that is a valid form of email address (I don't check that it is a valid address.) I have other checks that I do to make sure it is not abused, but I still get people trying to use to send spam.
|
londrum
#:3892332
| 6:48 pm on April 14, 2009 (utc 0) |
the only reason that i thought of getting the sender to input their own address was that the receiver was more likely to read it that way. if he receives something from blah@example.com, then he might not know what it is and delete it as spam. do you reckon the domain on the sender's address has to match the domain that it's being sent from?
|
rainborick
#:3892509
| 11:22 pm on April 14, 2009 (utc 0) |
Using the sender's address as the "From:" is a bad idea that's been done to death. It will almost always have the opposite effect in terms of getting users to read the message. People know when they send themselves Email, and when they don't recognize the message they will almost always assume its SPAM. It wouldn't surprise me if Yahoo! mail filters self-addressed Email automatically when the message originates from a different domain. Use an appropriate return address in the same domain as the site where the mail originates and you'll have much better results, even if it doesn't fix this particular issue.
|
daveginorge
#:3894659
| 3:26 pm on April 17, 2009 (utc 0) |
You state you have your own server, I do know that AOL and a few others will not accept mail from servers with dynamic addresses, you may need to configure the server to use a smart_host (linux or IIS) or a send connector (Exchange server), this is normally your isp's smtp server Microsoft IIS or Sendmail
|
rocknbil
#:3894729
| 4:39 pm on April 17, 2009 (utc 0) |
You probably know, the issue is not with PHP. Valid headers? SPF records in place? DNS set up correctly? DNS DOES have an effect on email. (scary) server on any RBL lists? Do a search for spam check, email spam checker, something along those lines, there are many out there. Paste in your message with full headers, what does it tell you?
|
londrum
#:3894799
| 6:13 pm on April 17, 2009 (utc 0) |
i worked it out in the end. i changed it so that the senders address was my own domain (where the email came from), but it still got rejected. the issue was actually with my host. they send all the emails through another server as a security measure, so it always looked like the email came from them (which is another domain name entirely) they suggested adding ini_set("sendmail_from", "yourdomain@example.com");
to my script, and everything is working alright now.
|
NeilsPHP
#:3895603
| 4:00 pm on April 19, 2009 (utc 0) |
londrum, I ran into this sometime.Check this in your php mail script: $headers = "From:webmaster@example.com Make sure you have a small space after colon like this $headers = "From: webmaster@example.com This should solve the issue for Yahoo.I don't know why AOL won't accept mails.anybody ?
|
subhankar ray
#:3895766
| 11:21 pm on April 19, 2009 (utc 0) |
Your server mail log may have some information about why Yahoo is rejecting them. For yahoo setting up domainkey besides SPF can be helpful. Reverse DNS [hope this term is correct] related to your server IP must be set. Checking the server IP black list is also a good idea. [I am skipping links to avoid violating TOS here, you can send me a message through my profile]
|
londrum
#:3895952
| 8:29 am on April 20, 2009 (utc 0) |
thanks guys, but it's fixed already. i mentioned the solution above
|