Reaper0167 Posted June 30, 2009 Share Posted June 30, 2009 my hosting server will not allow me to use the mail() function. I get this error message. Warning: mail() [function.mail]: SMTP server response: 554 The message was rejected because it contains prohibited virus or spam content Variables that I'm using. $user_in = $_POST['pin_find']; $user_email = $_POST['email_find']; $to = $user_email; $subject = 'Username Request'; $from = 'mysite.com'; $message = 'Thank you for being a member of mysite.com Your username is'; <?php if(mail($to, $subject, $message, "From: $from")) { echo "Email sent"; } ?> Is there anything else I could do to make this work? I would like to leave it as a PHP page. Quote Link to comment https://forums.phpfreaks.com/topic/164320-solved-php-mail-function-with-my-server/ Share on other sites More sharing options...
RussellReal Posted June 30, 2009 Share Posted June 30, 2009 I think in the email you're sending which you're not showing here.. has words like "free", "bank account", "account", "credit card", etc Quote Link to comment https://forums.phpfreaks.com/topic/164320-solved-php-mail-function-with-my-server/#findComment-866793 Share on other sites More sharing options...
Reaper0167 Posted June 30, 2009 Author Share Posted June 30, 2009 the only thing I'm sending is what is in the variables that I mentioned. Quote Link to comment https://forums.phpfreaks.com/topic/164320-solved-php-mail-function-with-my-server/#findComment-866797 Share on other sites More sharing options...
PFMaBiSmAd Posted June 30, 2009 Share Posted June 30, 2009 Short email messages that contain URL's are sometimes voted as spam by spam filtering software. You might consider lengthening the message body (a disclaimer about it being sent by an automated system and if the recipient did not cause it to be sent perhaps notify the site administrator...). About the only other possibility based on what you have posted is that your mail server has your domain on a spam list and won't send any email with it in the message body or the From: address. You should probably be asking your web host the reason why the mail server is returning that response for the subject, message, and from address that you are using to make up the email. He can tell you exactly, we can only guess. Quote Link to comment https://forums.phpfreaks.com/topic/164320-solved-php-mail-function-with-my-server/#findComment-866798 Share on other sites More sharing options...
Philip Posted June 30, 2009 Share Posted June 30, 2009 Make sure you're sending all the correct headers (the full FROM and such) Are you by chance on GoDaddy? I've heard of a lot of people that use GoDaddy hosting having to contact them to take their site off a spam list to send out emails. Quote Link to comment https://forums.phpfreaks.com/topic/164320-solved-php-mail-function-with-my-server/#findComment-866800 Share on other sites More sharing options...
Reaper0167 Posted July 1, 2009 Author Share Posted July 1, 2009 yes, its godaddy. I'm on the phone with them right now. Will call this one solved until further notice. Quote Link to comment https://forums.phpfreaks.com/topic/164320-solved-php-mail-function-with-my-server/#findComment-866810 Share on other sites More sharing options...
Reaper0167 Posted July 1, 2009 Author Share Posted July 1, 2009 Ok, I got it to work. All I did is take out the $from variable from the script(which is mentioned in my first post) And I tested it with my personal email. The subject of the email comes up as webmaster@secureserver.net Which godaddy said that is them. How can I still use the $from in my script? Is that with the header info you were talking about? Quote Link to comment https://forums.phpfreaks.com/topic/164320-solved-php-mail-function-with-my-server/#findComment-866816 Share on other sites More sharing options...
PFMaBiSmAd Posted July 1, 2009 Share Posted July 1, 2009 The From: address needs to be a mail box hosted on the sending mail server. Was it? Quote Link to comment https://forums.phpfreaks.com/topic/164320-solved-php-mail-function-with-my-server/#findComment-866819 Share on other sites More sharing options...
Reaper0167 Posted July 1, 2009 Author Share Posted July 1, 2009 no it wasn't. I will try that. Quote Link to comment https://forums.phpfreaks.com/topic/164320-solved-php-mail-function-with-my-server/#findComment-866828 Share on other sites More sharing options...
Reaper0167 Posted July 1, 2009 Author Share Posted July 1, 2009 I put my hosting server email, but the name is still the webmaster from godaddy. <?php include "connection.php"; $user_in = $_POST['pin_find']; $user_email = $_POST['email_find']; $to = $user_email; $subject = 'Username Request'; $from = 'myname@mysite.com'; $message = 'Thank you for being a member Your username is'; $sql = "SELECT username FROM members WHERE secret_code = '$user_in' AND email = '$user_email' LIMIT 1"; $result = mysql_query($sql); $count=mysql_num_rows($result); if($count == 1) { if(mail($to, $subject, $message, $from)) { echo "Email sent"; } else { echo "Email not sent"; } } ?> Quote Link to comment https://forums.phpfreaks.com/topic/164320-solved-php-mail-function-with-my-server/#findComment-866831 Share on other sites More sharing options...
Reaper0167 Posted July 1, 2009 Author Share Posted July 1, 2009 i fixed it. i'll post it now. Quote Link to comment https://forums.phpfreaks.com/topic/164320-solved-php-mail-function-with-my-server/#findComment-866832 Share on other sites More sharing options...
Reaper0167 Posted July 1, 2009 Author Share Posted July 1, 2009 <?php $to = $user_email; $subject = 'Username Request'; $headers = 'From: me@mysite.com' ; $message = 'Thank you for being a member.'; mail($to, $subject, $message, $headers); ?> Quote Link to comment https://forums.phpfreaks.com/topic/164320-solved-php-mail-function-with-my-server/#findComment-866836 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.