php - Mail Headers Cause Failure -
php - Mail Headers Cause Failure -
i making contact form. i've gotten rudimentary version work (gathering form info , sending email site personal email) cannot seem 'additional headers' work. works fine if have next headers:
$headers = 'mime-version: 1.0' . "\r\n"; $headers .= 'content-type: text/html; charset=iso-8859-1' . "\r\n";
but if seek , add together additional mail service headers such as:
$headers .= 'to: jack <jack johnson>' . "\r\n"; $headers .= 'from: birthday reminder <birthday@example.com>' . "\r\n"; $headers .= 'cc: birthdayarchive@example.com' . "\r\n"; $headers .= 'bcc: birthdaycheck@example.com' . "\r\n"; $headers .= "\r\nx-mailer: php/" ;
i 'fail' on mail service function. i'm using php version 5.3.8. create sure mail service function working doing this:
$sendmail = mail($email_to, $email_subject, $email_message, $headers); if ($sendmail) { echo '<div>thanks submitting!</div>'; } else { echo '<div>fail</div>'; }
am formatting incorrectly?
$headers .= 'to: jack <jack johnson>' . "\r\n";
as mentioned in comments, doesn't need there. cause problem because doesn't contain email address
also mentioned in comments, have double \r\n
including @ start of
$headers .= "\r\nx-mailer: php/" ;
finally, shouldn't cause problem, shouldn't it:
$headers .= 'bcc: birthdaycheck@example.com' . "\r\n";
bcc lines not belong in header. appear in header recipients, undermining point of bcc. find handled intermittently in different mail service clients , services. display it, maintain it, "kindly" hide headers.
php's mail() isn't designed handle bcc, need phone call mail() function , separately send bcc recipient
php email email-headers
Comments
Post a Comment