Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Make sure the email address you are using as the FROM is actually an email address. I have had the same issue been resolved by going into my account management from the host (one.com for you) and adding the account that I want the email to be from. I added an account called "mailer" and through the panel I was able to setup an auto-responder that said, "Sorry. This email address is reserved for server functions".</p> <p>in the from header you would then use (mailer@yourdomain.com)</p> <p>having that actual email address and auto-reponder did the trick. I think gmail is just smart enough to know that an email adress that has never been used before is spam. Also, the email address must come from the domain that the script lives on so that when it says it is FROM there it is not lying.</p> <p>here is the code that I use when I want to send email from my shared host (justhost.com) , It does not go to spam (this is using post data from a web form):</p> <pre><code>&lt;?php // Contact subject $subject = $_POST["subject"]; // Details $message=$_POST["detail"]; // Email of sender $mail_from=$_POST["customer_mail"]; //Name of sender $name=$_POST["name"]; putenv("TZ=America/Phoenix"); $now = date("F j, Y, g:i a T"); $header="Reply-To: $name &lt;$mail_from&gt;"; $header .= "From: MyDomainName.com &lt;mailer@mydomainname.com&gt;"; $header .= "\r\n"; $header .= "Reply-To: $name &lt;$mail_from&gt;"; $introMSG= "Message From:".$name." &lt;".$mail_from."&gt;"."\r\n" ."Sent On:".$now."\r\n"."From a web form on MyDomaiNname.com"."\r\n"."----------- -----------------------"."\r\n"."\r\n"; $to ='me@mydomainname.com'; // Domain Owners Email Address $send_contact=mail($to,$subject,$introMSG.$message,$header); $send_copy=mail($mail_from,"Copy Of:".$subject,$introMSG.$message,$header); // Check if message sent if($send_contact){ echo "&lt;strong&gt;Thanks! Your message has been sent to me.&lt;/strong&gt;"; } else { echo "&lt;strong&gt;There was an error sending your message &lt;/strong&gt;"; } if($send_copy){ echo "&lt;strong&gt;&lt;br&gt;A copy of this message was sent to your email.&lt;br&gt;If you do not receive a copy please check your spam folder&lt;/strong&gt;"; } else{ echo "&lt;strong&gt; There was an error sending a copy of this message to your email &lt;/strong&gt;"; } $send_reminder=mail("5555555555@txt.att.net","","You Have a new contact message from ".$name.", remember to check your spam folder.",$header); if($send_reminder){ echo "."; } else { echo "&lt;br&gt;&lt;strong&gt;TXT Error&lt;/strong&gt;"; } ?&gt; </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload