Note that there are some explanatory texts on larger screens.

plurals
  1. POSending emails, from header wrong with mail()
    primarykey
    data
    text
    <p>I have a commercial system that will send emails to customers "from" the agent who added them.</p> <p>When new agent is added, agent@domain.com is automatically created. So I want my email to be from CompanyName - Agent mail. This is how I tried to handle this:</p> <pre><code>$headers = "From:".$companyname." ".$Agentmail."\r\n"; $headers = "Reply-To:".$Agentmail."\r\n"; $headers .= "MIME-Version: 1.0\r\n"; $headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n"; </code></pre> <p>However, I get emails from "user"(user@servername) while <code>reply-to</code> is correct, as listed above. If I remove <code>reply-to</code>, it works perfect, e-mails in inbox will be shown as from CompanyName, and when opened, it will be CompanyName (Agentmail), however, such emails don't get sent to @hotmail addresses, which is a huge issue.</p> <p>Before you suggest that I completely switch my mail method to something along the lines of PHPMailer, please consider the way I use to send e-mails below, it may not be compliant with your suggestion. Thank you!</p> <p>Full e-mail code:</p> <pre><code>ob_start(); include("./email/mailtemplate.php"); $message = ob_get_clean(); $body = strtr($content, $replaceWord); $headers = "From:".$companyname." ".$Agentmail."\r\n"; $headers = "Reply-To:".$Agentmail."\r\n"; $headers .= "MIME-Version: 1.0\r\n"; $headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n"; mail($email, $subject, $message, $headers); </code></pre> <p>I echo <code>$body</code> inside mailtemplate.php, as it requires some parsing etc. Mailtemplate.php is simply html email template. </p> <p>Thanks</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

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