Forum Moderators: coopster

Message Too Old, No Replies

Mail not being received

         

gab1982

4:43 pm on May 19, 2009 (gmt 0)

10+ Year Member



Ok this is a strange issue which has been ratling my brain for a few days for, i have a link which when clicked does a query and is suppost to send an email it sends an email but some servers can't receive the email and i don't know why.

$query2="SELECT settings.siteurl, settings.emailaddress, settings.sitename, landlords.id, landlords.email from settings, landlords WHERE landlords.id = '$id'";
$server = $_SERVER['HTTP_HOST'];
$host = str_replace('www.','',$server);
$st=mysql_query($query2);
$recs=mysql_num_rows($st);
$row2=mysql_fetch_object($st);
$sitename = str_replace("&", "&","$row2->sitename");

$email = "".$row2->emailaddress."";
$landlordsemail = "".$row2->email."";
$subject = "".$sitename."";
$headers = "From: $sitename <notifications@$host>\r\nReply-To: ".$sitename." <".$email.">\r\n";

$message = "Your account with $sitename has now been activated, you can now login with your details:\n\n
Email address: $email\n

*** LANDLORDS LOGIN LINK *** \n
Landlords Login Link: ".$row2->siteurl."landlords-admin/index.php?step=1\n\n
If you have forgotten your password, you can change your password here: \n".$row2->siteurl."landlords-admin/forgotpassword.php
\n\n
Thank you.
$sitename\n
This is an automated response. Please do not reply!";

mail($landlordsemail, $sitename, $message, $headers);

that is my email code but i can't figure out why should it send it to some servers but not to others, i checked the junk box on those servers which don't seem to be receiving the email but they aren't showing and i can't check the logs as i don't have route access, the query is working otherwise it wouldn't work at all but why should it work to some emails and not others, the emails it doesn't work with don't have any special characters other than the @ so are no different to the ones which do.

daveginorge

5:39 pm on May 19, 2009 (gmt 0)

10+ Year Member



Have you checked with your ISP that they do not block some domains on mail sent from the localhost.

If you google for "mail not working" you get a lot of posts from this site on just the same subject.