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
Share on other sites

Basically, I have a huge HTML email that I want to drop into the $message string. I have got to go through the many lines and add the slashes in if I do it in the above example.

 

Is there a way that I can close the PHP tag ?> and open it again at the end?

Link to comment
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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.