ayok Posted January 11, 2011 Share Posted January 11, 2011 Hi, I've got a problem with php mail function. It works actually fine with normal e-mails, but it's not sent when the e-mail address is an alias. This is what i mean. The client has for example www.client.com and the e-mail address should be like info@client.com. HOwever he created this e-mail address at gmail. I don't really understand how, but these alias (like admin@client.com, info@client.com, etc) were made with gmail account. So anything which is sent to info@client.com will be redirected to his gmail account. But then, the php mail() cannot send to these addresses. Has anyone had this experience? What is the solution? Thanks in advanced, ayok Quote Link to comment https://forums.phpfreaks.com/topic/224066-php-mail/ Share on other sites More sharing options...
trq Posted January 11, 2011 Share Posted January 11, 2011 Doesn't sound like a php mail() issue to me, sounds more like something misconfiguration on the mail server end. Quote Link to comment https://forums.phpfreaks.com/topic/224066-php-mail/#findComment-1157822 Share on other sites More sharing options...
ayok Posted January 11, 2011 Author Share Posted January 11, 2011 Hi, thanks thrope, I've just looked into the DNS settings, the email is redirected to ASPMX.L.GOOGLE.COM. I don't know if someone can help me here, but i will search about it. Quote Link to comment https://forums.phpfreaks.com/topic/224066-php-mail/#findComment-1157828 Share on other sites More sharing options...
ayok Posted January 11, 2011 Author Share Posted January 11, 2011 Is it possible to get a "non-delivered message" if it's not sent? to my email for example? Quote Link to comment https://forums.phpfreaks.com/topic/224066-php-mail/#findComment-1157842 Share on other sites More sharing options...
colleyboy Posted January 11, 2011 Share Posted January 11, 2011 have you tried sending email to these addresses outside of php ... like in a normal email program to see if they are set up properly. It sounds like a DNS error where it is not sure where to forward the emails to. I suggest you send a test email to see if you receive that first. Quote Link to comment https://forums.phpfreaks.com/topic/224066-php-mail/#findComment-1157844 Share on other sites More sharing options...
ayok Posted January 11, 2011 Author Share Posted January 11, 2011 It's strange that i can just e-mail them. I saw in their DNS setting that the MX (10) is sent to ASPMX.L.GOOGLE.COM, MX(20) to ALT1.ASPMX.L.GOOGLE.COM, ALT2.ASPMX.L.GOOGLE.COM, ALT3.ASPMX.L.GOOGLE.COM. etc.. Quote Link to comment https://forums.phpfreaks.com/topic/224066-php-mail/#findComment-1157855 Share on other sites More sharing options...
PFMaBiSmAd Posted January 11, 2011 Share Posted January 11, 2011 It's more likely that your code is putting an address into the From: mail header that is not an email address hosted at your sending mail server. For example, you are putting the email address that someone entered in a form into the From: address. Could you post the code you are using. Quote Link to comment https://forums.phpfreaks.com/topic/224066-php-mail/#findComment-1157858 Share on other sites More sharing options...
ayok Posted January 11, 2011 Author Share Posted January 11, 2011 Here is my code $query_adminsite = "SELECT * FROM owner"; $adminsite = mysql_query($query_adminsite) or die(mysql_error()); $data = mysql_fetch_array($adminsite); $Name = $data['name']; //senders name from database (owner) $email = $_POST['email']; //senders e-mail adress $recipient = $data['email']; //recipient e-mail from database (owner) $subject = "Sent from ".$Name; //subject $header = "From: ".$email . "\r\n"; //optional headerfields //mail body $content .= "Name: " . $_POST['name'] . "\n"; $content .= "Company: " . $_POST['company'] . "\n"; $content .= "Address: " . $_POST['address'] . " " .$_POST['number']."\n"; $content .= "Postcode/City: " . $_POST['pcode'] . " " .$_POST['city']."\n"; $content .= "Phone number: " . $_POST['phone'] . "\n"; $content .= "E-mail:" . $_POST['email'] . "\n"; $content .= "Comments: " . $_POST['remarks'] . "\n\n"; if(mail($recipient, $subject, $content, $header)) { echo '<p>Sent!</p>'; $show = false; } else { echo '<p>Not sent</p>'; $show = false; } Quote Link to comment https://forums.phpfreaks.com/topic/224066-php-mail/#findComment-1157875 Share on other sites More sharing options...
BlueSkyIS Posted January 11, 2011 Share Posted January 11, 2011 PFMaBiSmAd is correct. Do not set the FROM field to an address that is not a real email address ON THE SERVER SENDING THE EMAIL. Quote Link to comment https://forums.phpfreaks.com/topic/224066-php-mail/#findComment-1157897 Share on other sites More sharing options...
ayok Posted January 11, 2011 Author Share Posted January 11, 2011 Hmm.. that makes sense, but... it's sent to normal e-mail (err.. i mean like my e-mail). The only e-mail that is not able to receive the messages is their e-mail which has been made on gmail (alias). Quote Link to comment https://forums.phpfreaks.com/topic/224066-php-mail/#findComment-1157915 Share on other sites More sharing options...
PFMaBiSmAd Posted January 11, 2011 Share Posted January 11, 2011 Most of the major ISP's check that the email is actually coming from a mail server that is authorized to send an email for the domain in the From: address. You should put the email address from the form into the Reply-to: mail header and put a valid email address at the sending mail server into the From: mail header. Would you trust a letter with a From: address of your bank, but the post mark (where it was actually mailed from) was a different country from where your bank is located? Quote Link to comment https://forums.phpfreaks.com/topic/224066-php-mail/#findComment-1157920 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.