php - Email content within variable -


i creating form online , need email sent out contain content file.

my headers setup this

@mail($email_to, $email_subject, $email_message, $headers); 

and content here

$email_message = file_get_contents('http://www.link.co.uk/wp-content/themes/themename/email-content.php'); 

the file contains email template, problem have template emailed out in raw format.

here code:

$email_message = file_get_contents('http://www.link.co.uk/wp-content/themes/themename/email-content.php');   // create email headers  $headers = 'mime-version: 1.0' . "\r\n"; $headers = 'content-type: text/html; charset=iso-8859-1' . "\r\n";                                    $headers = 'from: '.$email_from."\r\n".  'reply-to: '.$email_from."\r\n" .  'x-mailer: php/' . phpversion();  @mail($email_to, $email_subject, $email_message, $headers);  

the problem here brad, headers broken , being overwritten.

$headers = 'mime-version: 1.0' . "\r\n"; $headers = 'content-type: text/html; charset=iso-8859-1' . "\r\n"; $headers = 'from: '.$email_from."\r\n". 

add concatenates (dots)

$headers  = 'mime-version: 1.0' . "\r\n"; $headers .= 'content-type: text/html; charset=iso-8859-1' . "\r\n"; $headers .= 'from: '.$email_from."\r\n". 

concatenates chain links. if 1 missing or there none, won't "hold" or gets broken. ;-) last line gets processed , ignores both mime , html declarations.

$headers = 'from: '.$email_from."\r\n". ....

which valid declaration since holds valid from:, it's email isn't "formatted" way wanted be.


Comments

Popular posts from this blog

javascript - Chart.js (Radar Chart) different scaleLineColor for each scaleLine -

apache - Error with PHP mail(): Multiple or malformed newlines found in additional_header -

java - Android – MapFragment overlay button shadow, just like MyLocation button -