Jump to content

mail() HTML formatted email


MSwanson

Recommended Posts

I'm having problems with the following code.  If I don't use the HTML formatted email, it works without a problem, but if I try to, I get various errors.  I'm sure it is a simple syntax error.

Any help would be appreciated!
[code]
$name = $_POST['first_name'];
          $email = $_POST['email'];
          $toaddress = '[email protected]'; // EMAIL TO INFO
          $fromaddress = $_POST['email'];
          $replyaddress = $_POST['email'];
          $subject = "FVCC Contact from {$_POST['first_name']} {$_POST['last_name']}";
          //$content = $_POST['comments'];     
  $content = '
<html>
<head>
  <title>Website Contact</title>
</head>
<body>
<strong>Customer Information: </strong>
<br>
{$_POST['first_name']} {$_POST['last_name']}
{$_POST['address']}
{$_POST['city'], {$_POST['state']} {$_POST['zip']}
<br>
<strong>Email Address:</strong>
{$_POST['email']}
<br>
<strong>Comments:</strong>
{wordwrap($_POST['comments'])}
</body>
</html>
';
[/code]
Link to comment
https://forums.phpfreaks.com/topic/34134-mail-html-formatted-email/
Share on other sites

My best guess would be that you are using " or ' which is interfering with the code.  Try addslashes() and then on the final output (sending the code) stripslashes().  If you receive any further errors I am not sure, this is the only possibility I can think of IMO. GL

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.