0

$first の PHP 変数を css でスタイルしようとしているコードがいくつかありますが、明らかに何かが正しくないため、ここにいます。

最終的には、このメッセージ全体のスタイルを設定し、ロゴや背景色を含めて、このメールが送信されたときに「html メール」になるようにしたいのですが、PHP については何も知りません。少しずつ学んでいると思います。 .

ここに私のコードがあります: ------->

$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);
4

3 に答える 3

0

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);
于 2013-08-20T01:40:16.407 に答える
0

私はおそらく変更することから始めます

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

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

また、テキストの大きなチャンクにはHEREDOCをお勧めします。

$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;
于 2013-08-20T01:41:14.023 に答える
0

おそらく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>';
于 2013-08-20T01:42:29.007 に答える