php mail() function assumed to be spam

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
jolinar
Forum Commoner
Posts: 61
Joined: Tue May 24, 2005 4:24 pm
Location: in front of computer

php mail() function assumed to be spam

Post by jolinar »

I'm not sure if this problem can be resolved or whether I'm not coding this right, but all messages generated by php's mail() function are assumed to be spam. this isn't a problem when contacting a provider with a bulk mail folder (like the yahoo account I sometimes), problem is that my primary account seems to throw the messages away. Does anyone know how to make the messages seem more "human"? (Please remember that I'm NOT using this for spam, it's part of a password generating script I'm working on. Here is the code in question:

Code: Select all

$subject = "User Password For $user_name_reset";
$message = "This is an automated message.  If you did not intend to recieve it, please ignore it.\n\nYou requested your password to be reset and/or confirmation of your username.\n\nUsername: $user_name_reset\nPassword: $pass\n\nRegards, Dan";
$headers = 'From: Hades';
mail($email_reset,$subject,$message,$headers);
			
print "<p>Your username/password has been e-mailed to you.  Please check the account you used to register</p>\n";
Also, the messages appear as being from: Hades@ localhost.localdomain
I think this is because I'm hosting it on a dedicated linux with dynamic DNS, can I change that name by altering the /etc/hosts file?
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

Spam flags go up usually in response to the headers you use (or don't use, in some cases) and the content of your message hitting certain words or being composed in various ways.

If you don't fully understand how email works, or just don't care to, we'll likely suggest using a mailing library such as Swift.

Of course, if your server is a dynamic IP or is blacklisted for some reason, it's likely that even a library will be unable to help you in that regard.
User avatar
jolinar
Forum Commoner
Posts: 61
Joined: Tue May 24, 2005 4:24 pm
Location: in front of computer

Post by jolinar »

I guess that makes testing a little more complicated. Thanks anyway
Post Reply