PHP变量和样式

PHP变量和样式,php,html-email,Php,Html Email,我在这里有一些代码,我试图用css设置PHP变量$first的样式,但显然有些地方不正确,因此我在这里 我最终想设计整个邮件的样式,包括一个徽标和/或背景色,这样当发送这封邮件时,它就是一封“html电子邮件”,但我对PHP一无所知,我想我正在一点一点地学习 这是我的代码:----> $user=“$email”; $usersubject=“感谢您的订阅”; $userheaders=“From:subscriptions@3elementsreview.com\n”; $userheader

我在这里有一些代码,我试图用css设置PHP变量$first的样式,但显然有些地方不正确,因此我在这里

我最终想设计整个邮件的样式,包括一个徽标和/或背景色,这样当发送这封邮件时,它就是一封“html电子邮件”,但我对PHP一无所知,我想我正在一点一点地学习

这是我的代码:---->

$user=“$email”;
$usersubject=“感谢您的订阅”;
$userheaders=“From:subscriptions@3elementsreview.com\n”;
$userheaders.=“内容类型:text/html\r\n”;

$usermessage=“Welcome尝试对HTML属性使用双引号,并连接$first变量,如下所示:

$user = "$email";
$usersubject = "Thank you for subscribing";
$userheaders = "From: subscriptions@3elementsreview.com\n";
$userheaders .= "Content-type: text/html\r\n";
$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);
$user=“$email”;
$usersubject=“感谢您的订阅”;
$userheaders=“From:subscriptions@3elementsreview.com\n”;
$userheaders.=“内容类型:text/html\r\n”;
$usermessage=“欢迎”。$first。”,
我们很高兴您决定订阅我们的电子邮件列表!
在3Elements,有很多伟大的事情正在发生,我们迫不及待地向您展示。
因此,请继续关注有关提交周期、发行日期、竞赛和其他新闻的通知。另外,一定要在Facebook上喜欢我们,在Twitter上关注我们!
真诚地
三要素小组
www.3ElementsReview.com
Facebook.com/3elementsreview
@3“元素视图”;
邮件($user、$usersubject、$usermessage、$userheaders);

我可能会从改变开始

<span style='color:#ff6000; font-size:1.25em; font-    weight:bold;>

您可能丢失了html或body标记?我发布了一个当前有效的版本。您可以在此基础上进行修改。请注意,gmail、yahoo等不同的邮件服务器检测到不同的代码格式。这里有一个很好的比较

  $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>';
$mail\u body=”

新闻稿 你好,“$name.”

~Philip@ChenLik药房私人有限公司


这是计算机生成的新闻稿,请不要回复此电子邮件。若要取消订阅

';
你能解释一下什么不起作用吗?例如,错误消息、错误样式、什么都不做等等。看起来你忘记问你的问题了?…并且把它放在CSS中file@rath你以前从未尝试过设计HTML电子邮件的样式,是吗?)非常感谢Phil。我认为你的答案行不通,因为我认为我的代码转换了我在这里犯了一个简单的错误,但我想不是,我的实际代码中一定没有注意到这一点。CSS对我来说有些陌生,周围都是PHP代码。再次感谢。
<span style='color:#ff6000; font-size:1.25em; font-weight:bold;'>
$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;
  $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>';