Jump to content

PHP email help


metalhead12690

Recommended Posts

I am trying to get this email to work but every time I send it to myself I get this error:Parse error: syntax error, unexpected T_STRING in /home/s159a10/public_html/test.php on line 37

<?php$to = '  ';$subject = 'Test HTML in email';$message = '<html><head><title>test</title><style type="text/css">body {      background-color: red;      color: blue;     }</style></head><body><p>This is a test</font></p><table border = 1><tr><td>This is the first cell</td><td>This is the second cell</td></tr><tr><td>test test test test</td><tr><td>test test test test</td><td><img src="http://images.wikia.com/familyguy/images/c/c2/Peter_Griffin.png"></td></tr></table>      <ul><li>Item #1</li><li>Item #2</li><li>Item #3</li></ul><div align="center"><p>Sony Online Entertainment today offered more details on how it will compensate customers affected by the three-week-long outage of the PC and console gaming network, which Sony says should be online in "at least a few more days."U.S. customers with an account for the multiplayer online gaming service will get free identity theft protection from security firm Debix. Customers in other countries will be getting similar offers soon, according to the statement. This is in addition to the offer made last week to PlayStation Network and Qriocity customers affected by the same breach.In addition, all players will get one month of free service as compensation, plus another free day for every day past one month the service remains inaccessible. Sony Online is also giving players in-game bonuses for several of its titles, both for PC games and PlayStation 3 games such as DC Universe Online, Free Realms, and EverQuest.Customers who've paid for "lifetime" subscriptions will get free in-game currency (20,000 coins for Free Realms, 7,500 Galactic Credits for Clone Wars Adventures, and 10 Marks of Distinction for DC Universe Online).For a complete list of the in-game bonus items, see the company's statement.Several of Sony's servers were attacked between April 17 and April 19, leading to the exposure of personal data of more than 100 million customers who signed up for PlayStation Network, Qriocity, and Sony Online. The company took the networks for downloading and playing games, movies, and music offline three weeks ago and said earlier this week it plans to restore them "in the next few days."</p></div></body></html>';$headers = 'MIME-Version: 1.0' . "\r\n";$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";$headers .= 'To: Test <>' . "\r\n";$headers .= 'From: Me <>' . "\r\n";$headers .= 'Cc: PG<>' . "\r\n";mail($to, $subject, $message, $headers);echo "Mail sent to $to";?>

Link to comment
Share on other sites

That usually means that a quoted string or a control block ended before you think it should, and the interpreter doesn't understand the characters that come after the closing delimiter.In your case, you're delimiting the HTML in 'single quotes' , but there are several apostrophes inside the quote, and the interpreter thinks the first one is the closing delimiter. I count at least 3, but there may be more. Escape them like so: who\'veYou might also explore heredoc and nowdoc syntax. (nowdoc only available > 5.3)

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...