Jump to content

help with PHP mail


rohithreddyk

Recommended Posts

Hi...i am using this code to send mail to the user when he forgets his password and enters his email id and clicks "send password" button...

 

$recipient=$emailid;
$subject="Password for ****";
$message="password for given userid is  ".$password;
$headers = "From: [email protected]>\r\n";
$headers .= "Reply-To: [email protected]\r\n";
$headers .= "Return-Path: [email protected]\r\n";
$headers .= 'MIME-Version: 1.0' . "\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
if(mail($recipient, $subject, $message, $headers))
     header("Location:login.php?msg='Your username/password is mailed to your id'");
else
     echo "mail cannot be send this time";

 

$emailid , $password are obtained from database.

Strangely when i have $emailid as some gmail or yahoo mail id it works just fine.. I receive mail with the password.. but when I have $emailid as my university mail id (******@uh.edu & also *****@central.uh.edu) or my department email id (*****@mail.cs.uh.edu) I am not receiving any mail or the error message either. the "if" conditions is becoming true and I am being redirected to login page...

 

 

 

Link to comment
https://forums.phpfreaks.com/topic/159920-help-with-php-mail/
Share on other sites

Thanks Neil...Can you help with these questions please?

 

1).why does the university blocks these messages that were perfectly accepted by google n yahoo?

2).is there anyway I can overcoming this without contacting web server admin...

3).If I have to contact web server admin, what all the information I should provide him to overcome this?

Link to comment
https://forums.phpfreaks.com/topic/159920-help-with-php-mail/#findComment-844231
Share on other sites

One reason maybe, your message headers say the message is from [email protected] however the domain gmail.com will not resolve back to your servers IP address. This could be seen as mail relayed spam. You should send the messages from an alias of the website domain name. Reverse DNS is setup in the PTR entry of the DNS record for your domain. AOL block messages for the same reason http://postmaster.aol.com/guidelines/standards.html

 

Your university may not accept messages from free email accounts like gmail, etc. This is not uncommon.

 

You need to check your server for any bounced messages to get details on why they did not end up in the correct location. Without this info it is hard to say.

 

The IP address of your server maybe on a mail blacklist. This is not uncommon on shared servers as you never know what other users are doing in terms of sending email. Check your server IP with http://dnsstuff.com

Link to comment
https://forums.phpfreaks.com/topic/159920-help-with-php-mail/#findComment-844256
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.