您好, 欢迎来到 !    登录 | 注册 | | 设为首页 | 收藏本站

通过PHP在电子邮件中发送HTML

通过PHP在电子邮件中发送HTML

非常简单,将图像保留在服务器上,然后将PHP + CSS发送给它们…

$to = 'bob@example.com';

$subject = 'Website Change Reqest';

$headers = "From: " . strip_tags($_POST['req-email']) . "\r\n";
$headers .= "Reply-To: ". strip_tags($_POST['req-email']) . "\r\n";
$headers .= "CC: susan@example.com\r\n";
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Content-Type: text/html; charset=UTF-8\r\n";

$message = '<p><strong>This is strong text</strong> while this is not.</p>';


mail($to, $subject, $message, $headers);

正是这一行告诉邮件发件人和收件人,该电子邮件包含(希望)格式正确的HTML,需要对其进行解释:

$headers .= "Content-Type: text/html; charset=UTF-8\r\n";

这是我获得信息的链接。(link …)

您将需要安全…

php 2022/1/1 18:15:02 有476人围观

撰写回答


你尚未登录,登录后可以

和开发者交流问题的细节

关注并接收问题和回答的更新提醒

参与内容的编辑和改进,让解决方法与时俱进

请先登录

推荐问题


联系我
置顶