Jump to content

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 support@techinnovators.com\r\n";
$headers .= 'MIME-Version: 1.0' . "\n";

 

or

 

$headers = "From: support@techinnovators.com\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 support@cp-645.webhostbox.net

 

$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

yes tried like

John Doe <example@example.com>

and

 

John Doe example@example.com

 

and also

 

$email = $_POST['email'];

John Doe {$email}

 

but the email will not be delivered...

 

ad if i do just the from: John Doe then its sent but as support@cp-645.webhostbox.net

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

oh just to be on safe side added 2 Conten-type and do you mean this

 

 

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

 

i have tried my coding on 2 web hosts on 1 its works like charm but on 1 thi error happens

Edited by lovephp
Link to comment
https://forums.phpfreaks.com/topic/271007-mail-headers-issue/#findComment-1395215
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@somedomain.com but $to is gmail, yahoo hotmail email ids which i input on form. the email goes without any issue to email@somedomain.com 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

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.