Jump to content

HTML email


petenaylor

Recommended Posts

Hi all

 

How can I shut off the PHP tag in the below code so I can edit the email message in WYSIWYG? I want to be able to create a HTML email and then insert it into the PHP message string:

 

$message = "
<html>
<head>
<title>HTML email</title>
</head>
<body>
<p>This email contains HTML Tags!</p>
<table>
<tr>
<th>Firstname</th>
<th>Lastname</th>
</tr>
<tr>
<td>John</td>
<td>Doe</td>
</tr>
</table>
</body>
</html>
";

 

Many thanks

Pete

Link to comment
https://forums.phpfreaks.com/topic/260605-html-email/
Share on other sites

yip,

<?php
/**
You PHP Code
*/
?>
Your HTML
<?php
/**
More PHP Code
*/
?>

 

BUT there are other ways, fling this into a new php file and run it:

<?php
$var = "variables";
$message = <<<HTML_MSG
<html>
<head><title></title></head>
<body>
<p>You'll find these string blocks rather handy at times like this</P>
<table border="1">
  <tr>
    <th colspan="2">Easy way to use string blocks in php</th>
  </tr>
  <tr>
    <td>1: make a variable and set it = to</td>
    <td>2: Openm the string block with <<<NAME_OF_BLOCK using that format(no spaces)</td>
  </tr>
  <tr>  
    <td>3: Enter your formated string, including php $var if you want them</td>
    <td>4: Close the string block with NAME_OF_BLOCK; - on it's own line with no white space before or after it</td>
  </tr>
</table>
</body>
</html>
HTML_MSG;
echo $message;
?>

Link to comment
https://forums.phpfreaks.com/topic/260605-html-email/#findComment-1335613
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.