I have some code here where I am trying to style the PHP variable of $first with css, but something obviously isnt right, hence the reason I am here.
I ultimately want to style this entire message and include a logo, and/or background color, so that when this email is sent out it's an "html email", but I know nothing about PHP, I guess I'm learning bit by bit.
Here is my code: ------->
$user = "$email";
$usersubject = "Thank you for subscribing";
$userheaders = "From: subscriptions@3elementsreview.com
";
$userheaders .= "Content-type: text/html
";
$usermessage = "Welcome <span style='color:#ff6000; font-size:1.25em; font- weight:bold;>$first</span>,
We're glad you've decided to subscribe to our email list!
There's a lot of great things happening at 3Elements that we can't wait to show you.
So stay tuned for notifications about submission periods, issue release dates, contests, and other news. Also, be sure to like us on Facebook and follow us on Twitter!
Sincerely,
The 3Elements Team
www.3ElementsReview.com
Facebook.com/3elementsreview
@3ElementsReview";
mail($user,$usersubject,$usermessage,$userheaders);
I'd probably start by changing
<span style='color:#ff6000; font-size:1.25em; font- weight:bold;>
to
<span style='color:#ff6000; font-size:1.25em; font-weight:bold;'>
I'd also recommend HEREDOC for large chunks of text, eg
$usermessage <<<EOD
Welcome <span style="color:#ff6000; font-size:1.25em; font-weight:bold;">$first</span>,
We're glad you've decided to subscribe to our email list!
There's a lot of great things happening at 3Elements that we can't wait to show you.
So stay tuned for notifications about submission periods, issue release dates, contests, and other news. Also, be sure to like us on Facebook and follow us on Twitter!
Sincerely,
The 3Elements Team
www.3ElementsReview.com
Facebook.com/3elementsreview
@3ElementsReview
EOD;
Try using double quotes for your HTML attributes and concatenate your $first variable, like so:
$user = "$email";
$usersubject = "Thank you for subscribing";
$userheaders = "From: subscriptions@3elementsreview.com
";
$userheaders .= "Content-type: text/html
";
$usermessage = "Welcome <span style=\"color:#ff6000; font-size:1.25em; font-weight:bold;\">".$first."</span>,
We're glad you've decided to subscribe to our email list!
There's a lot of great things happening at 3Elements that we can't wait to show you.
So stay tuned for notifications about submission periods, issue release dates, contests, and other news. Also, be sure to like us on Facebook and follow us on Twitter!
Sincerely,
The 3Elements Team
www.3ElementsReview.com
Facebook.com/3elementsreview
@3ElementsReview";
mail($user,$usersubject,$usermessage,$userheaders);
You probably missing the html or body tag? i post a version of mine that's currently working. you can modify on top of that. Please do aware that gmail,yahoo etc different mail server detect different code format. there is a great comparison somewhere
$mail_body = '
<html>
<body>
<p><img style="vertical-align: top;" src="http://www.chenlikonlinestore.com/css/images/logo.png" alt="logo" width="238" height="41" /></p>
<p><a class="right" title="ChenLikPharmacy Sdn Bhd" href="http://www.facebook.com/ChenLikPharmacy" target="_blank"><img src="http://ctrlq.org/html-mail/img/facebook.png" alt="Facebook" width="25" height="25" /></a></p>
<h3>Newsletter</h3>
<p>Hello ' . $name . ',</p>
<p><a href="http://www.chenlikonlinestore.com/promotions.php">Click here and check out our latest promotion!</a></p>
<p>~Philip @ ChenLik Pharmacy Sdn. Bhd.</p>
<hr />
<p>This is computer generated newsletter, please do not reply to this email. <a href="http://www.chenlikonlinestore.com/php_codes/optout.php?e='.$email.'">Click here</a> to unsubscribe</p>
</body>
</html>';