Jump to content

Recommended Posts

This is weird and happens a lot.

 

When I send an email from a php script

mail("[email protected]","Literature Request",$msg);

 

I receive the email in my GMAIL account, no problem. But when sending to any other email address (that ISN'T GMAIL), it doesn't get received. Not even in the spam folder.

 

Whats up with that?

 

Wes

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

Hotmail and Yahoo are notorious for this. It's basically their spam filters blocking the email.

 

You haven't set any headers or the senders address, that is probably why they aren't being received, the spam filters just drops it.

 

What I normally do to ensure the email gets through is set the  from, reply-to and return path headers. Often the senders email address needs to be on the same server as the web server, and it also helps if the email account does actually exist.

 

  $headers = "From: [email protected]\r\n";
  $headers .= "Reply-To: [email protected]\r\n";
  $headers .= "Return-Path: [email protected]\r\n";

  $success = mail($to, $subject, $body, $headers);

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

Negatory, here's the new code:

 

$headers  = "MIME-Version: 1.0 \r\n";
$headers .= "Content-type: text/html; charset=iso-8859-1 \r\n";
$headers .= "From: [email protected] \r\n";
$headers .= "Reply-To: [email protected] \r\n";
$headers .= "Return-Path: [email protected] \r\n";
mail("[email protected],[email protected]","Literature Request",$msg,$headers);

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

  • 4 weeks later...

I do not want to hijack your post, but I too, have this issue. The only thing that is differnet is, I am trying to let others email me via a form on my page. I only get success when I test it with emails addys that are on my domain. Any other email ( they do exist ) from my isp or yahoo or gmail all gets failed response. Is this the same cause?

 

P.S. I am really a newbie to this.

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.