Jump to content

Mail() $Headers Issue


lovephp

Recommended Posts

guys why is it that when i add email address to $headers reply or from then the email will not be delivered to email address eg:

 

$headers = "From: Tech Innovators [email protected]\r\n";
$headers .= 'MIME-Version: 1.0' . "\n";

 

or

 

$headers = "From: [email protected]\r\n";
$headers .= 'MIME-Version: 1.0' . "\n";

 

the above codes does not send the email but if i do like below without any email then only the email gets delivered and also the email address lookis like [email protected]

 

$headers = "From: Tech Innovators \r\n";
$headers .= 'MIME-Version: 1.0' . "\n";

Link to comment
https://forums.phpfreaks.com/topic/271007-mail-headers-issue/
Share on other sites

its like this

 

$headers = "From: $company_name <$company_email>\r\n";
  $headers .= "Reply-To: <$company_email>\r\n";
  $headers .= "Return-Path: $company_email\r\n";   
  $headers .= 'MIME-Version: 1.0' . "\n";
  $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";  
  $headers .= 'Content-type: text/html; charset=us-ascii' . "\r\n";
  'X-Mailer: PHP/' . phpversion();

Link to comment
https://forums.phpfreaks.com/topic/271007-mail-headers-issue/#findComment-1395210
Share on other sites

Adding additional, useless code to be on the "safe side" is no good. You cannot use more than a single Content-type. You could add 50 Content-type's but only one (the first one) will be used.

 

Does $company_email match the domain name? Or is it a @gmail.com address or something of the like?

 

Try the following:

 

mail($to, $subject, $message, $headers, "-f $company_name");

Link to comment
https://forums.phpfreaks.com/topic/271007-mail-headers-issue/#findComment-1395217
Share on other sites

Adding additional, useless code to be on the "safe side" is no good. You cannot use more than a single Content-type. You could add 50 Content-type's but only one (the first one) will be used.

...

unless it's a multipart mail, then you can have a different content type for each part - I know that's not the point you are making, but just to keep it all clear.

Link to comment
https://forums.phpfreaks.com/topic/271007-mail-headers-issue/#findComment-1395220
Share on other sites

Adding additional, useless code to be on the "safe side" is no good. You cannot use more than a single Content-type. You could add 50 Content-type's but only one (the first one) will be used.

 

Does $company_email match the domain name? Or is it a @gmail.com address or something of the like?

 

Try the following:

 

mail($to, $subject, $message, $headers, "-f $company_name");

 

$company_email is not gmail its [email protected] but $to is gmail, yahoo hotmail email ids which i input on form. the email goes without any issue to [email protected] but does not goes to yahoo, gmail or hotmail if add from: email address

Link to comment
https://forums.phpfreaks.com/topic/271007-mail-headers-issue/#findComment-1395547
Share on other sites

Does the email address in question match the domain/server?

 

When I checked out techinnovators.com, there is no site. A DNS check revealed different nameservers than webhostbox.net.

 

Different hosts will only allow certain header formations. Your best bet is to contact them and see what they allow.

Link to comment
https://forums.phpfreaks.com/topic/271007-mail-headers-issue/#findComment-1395566
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.