Forum Moderators: coopster
I have this bit of code
if (!isset($err)) {
// send confirmation email
$headers = 'From: '.$cfg['from'];
if ($cfg['headers']) {
foreach ($cfg['headers'] as $val) $headers .= "\n".$val;
}
$headers .= "\n".$cfg['header_plain'];
if (!@mail($cfg['fromname'], $addr, $cfg['subj_conf'], sprintf($cfg['msg_conf'], '?type=confirm&email='.urlencode($addr)), $headers)) {
$err = 'There was an error sending the confirmation email. Please try again later.';
}
}
I want the From field to include the sender's name (predefined as $cfg['fromname']) as well as address. I've searched the net but could only find this
$headers .= "From: \"".$fromname."\" <".$fromaddress.">\n";
Unfortunately, the above makes optional headers (Mime-Version and Content-Transfer-Encoding: 8bit) get included in the email body!
If anyone can help I'd appreciate it. I'm a complete noob at PHP
you have too many parameters there and the $headers variable is in the wrong place.
[php.net...]