Greetings,
I have not been able to find the documentation that will allow me to
insert
php code inside the html code in the $message block in the mail() function.
Using the example in the help file:
<?php
/* recipients */
$to = "valid@email.ad d" . ", " ; // note the comma
$to .= $_POST["email_addr ess"];
/* subject */
$subject = "CTO for {$_POST["Client_Nam e"]}";
/* message */
$message ='
<HTML>
<BODY>
<H1 ALIGN=CENTER><F ONT SIZE=7>CTO</FONT></H1>
<HR SIZE=10 color="blue">
<DIV ALIGN=LEFT>
<P><STRONG> Todays Date:"<?php echo $_POST["Date"]; ?>"</STRONG></P>
<HR SIZE=10 color="blue">
</BODY>
</HTML>
';
/* To send HTML mail, you can set the Content-type header. */
$headers = "MIME-Version: 1.0\r\n";
$headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
/* additional headers */
$headers .= "To: Department <valid@email.ad d>\r\n";
$headers .= "From: {$_POST["Sales_Pers on"]}
<{$_POST["email_addr ess"]}>\r\n";
$headers .= "Cc: {$_POST["Sales_Pers on"]} <{$_POST["email_addr ess"]}>\r\n";
/* and now mail it */
mail($to, $subject, $message, $headers);
?>
The above code displays the first line "CTO", the first HR then "Todays
Date:" and then
just a pair of double quotes. After that, the next HR and that's it.
The e-mail works fine, the script will pick-up the data from the html form
for the addresses.
Any help or direction would be appreciated.
Thanks,
Ray
To reply direct, take out spam.
I have not been able to find the documentation that will allow me to
insert
php code inside the html code in the $message block in the mail() function.
Using the example in the help file:
<?php
/* recipients */
$to = "valid@email.ad d" . ", " ; // note the comma
$to .= $_POST["email_addr ess"];
/* subject */
$subject = "CTO for {$_POST["Client_Nam e"]}";
/* message */
$message ='
<HTML>
<BODY>
<H1 ALIGN=CENTER><F ONT SIZE=7>CTO</FONT></H1>
<HR SIZE=10 color="blue">
<DIV ALIGN=LEFT>
<P><STRONG> Todays Date:"<?php echo $_POST["Date"]; ?>"</STRONG></P>
<HR SIZE=10 color="blue">
</BODY>
</HTML>
';
/* To send HTML mail, you can set the Content-type header. */
$headers = "MIME-Version: 1.0\r\n";
$headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
/* additional headers */
$headers .= "To: Department <valid@email.ad d>\r\n";
$headers .= "From: {$_POST["Sales_Pers on"]}
<{$_POST["email_addr ess"]}>\r\n";
$headers .= "Cc: {$_POST["Sales_Pers on"]} <{$_POST["email_addr ess"]}>\r\n";
/* and now mail it */
mail($to, $subject, $message, $headers);
?>
The above code displays the first line "CTO", the first HR then "Todays
Date:" and then
just a pair of double quotes. After that, the next HR and that's it.
The e-mail works fine, the script will pick-up the data from the html form
for the addresses.
Any help or direction would be appreciated.
Thanks,
Ray
To reply direct, take out spam.
Comment