私はユーザーの電子メールアドレスを収集してデータベースに送信する過程にありますが、本当にやりたいことはHTMLメールを送信することです。PHPの文書からHTMLメールを送信する
私は、電子メールのHTMLを作成しました(インラインCSSで、それは文字通り1ページです)、それは次のようになります。
それでは、私はこのコードを取り、PHPでのメールsubmittingnessを書いた:
ini_set("sendmail_from", "[email protected]");
$to = $email;
$subject = "Ben Potter Web Design - Newsletter Form Submission";
$emailthing = '
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Form Submission - Newsletter Update</title>
</head>
<style type="text/css">
body {
background-color:#e8faff;
}
p {
font-size:15px;
font-family:Georgia, "Times New Roman", Times, serif;
color:#141414;
font-style:italic;
}
#mainbox{
background-image:url(http://www.benjaminpotter.org/Images/emailtotheuser.jpg);
width:345px;
height:404px;
margin-left:auto;
margin-right:auto;
display:block;
margin-top:50px;
}
#mainbox #textholder{
width:279px;
height:300px;
display:block;
position:absolute;
margin-top:80px;
margin-left:30px;
}
#special{
color:#72C0EF;
text-align:center !important;
font-style:normal;
}
</style>
<body>
<div id="mainbox">
<div id="textholder">
<p>
Thanks for signing up!<br />
I currently have you under the email:<br />
<span id="special">' . $email . '</span>
<br />
<br />
You will be receiving tri-monthly/<br />
quarterly emails from me, updating you<br />
on my latest works.<br />
<br />
Thank you for your intrest in <strong>Ben Potter
Web Design</strong>, you will receive the first newsletter soon.<br />
<br />
<br />
Yours Sincerely,
<br />
<strong>Ben Potter</strong>
</p>
</div>
</div>
</body>
</html>';
$Rconfucious = "MIME-Version: 1.0\r\n";
$Rconfucious .= "Content-type: text/html; charset=iso-8859-1\r\n";
$Rconfucious .= 'From: Ben Potter Web Design 2011 <[email protected]>' . "\r\n";
@mail($to, $subject, $emailthing, $Rconfucious);
しかし、問題は、それは次のように伝わってくるということです。
これはどうやって正しく動作するのですか? また、ちょっとしたメモ - 電子メールは常に迷惑メールにまっすぐに行きますが、これを変更する方法はわかりません...ユーザーが電子メールを直接見ることはありません。
ありがとうございました!
-1:これは上記のような状況とは何の関係もありません。電子メールはHTMLとして正しく送信されています。問題は、Gmailが「