Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/73.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何在php电子邮件中添加css样式?_Php_Html_Css - Fatal编程技术网

如何在php电子邮件中添加css样式?

如何在php电子邮件中添加css样式?,php,html,css,Php,Html,Css,如何在电子邮件php中添加标记?例如,我想用我的$for_通行证加粗。有什么想法吗?谢谢 $subject = "Password Recovery"; $message = "Hi! Your member password is <strong>$for_pass</strong>"; $from = "smilepartyplanner2014@gmail.com"; $headers = "From:" . $from; // send mail $mail_s

如何在电子邮件php中添加标记?例如,我想用我的$for_通行证加粗。有什么想法吗?谢谢

$subject = "Password Recovery";
$message = "Hi! Your member password is <strong>$for_pass</strong>";
$from = "smilepartyplanner2014@gmail.com";
$headers = "From:" . $from;
 // send mail
$mail_sent = @mail( $forgot_email, $subject, $message,$headers );
 //echo "Thank you for sending us feedback";

?>
<script>

alert("Your password has been sent to your email address. ");

</script>
<?php
$subject=“密码恢复”;
$message=“您好!您的会员密码为”$for_pass”;
$from=”smilepartyplanner2014@gmail.com";
$headers=“From:”$从…起
//寄信
$mail\u sent=@mail($忘记电子邮件,$subject,$message,$headers);
//echo“感谢您向我们发送反馈”;
?>
警报(“您的密码已发送到您的电子邮件地址。”);

您需要在邮件中发送MIME邮件头以告知其HTML,如下所示:

$headers = "From:" . $from . "\r\n";
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n";

$mail_sent = @mail($forgot_email, $subject, $message, $headers);

您需要在邮件中发送MIME邮件头以告知其HTML,如下所示:

$headers = "From:" . $from . "\r\n";
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n";

$mail_sent = @mail($forgot_email, $subject, $message, $headers);

正如您在邮件正文中看到的,但您需要在邮件头上声明内容类型

  ...
  $headers .= 'Content-type: text/html; charset=utf-8' . "\r\n";
  $headers .= "From:" . $from;

邮件正文可以有您想要的任何内联样式。

正如您在邮件正文中所做的那样,但您需要在标题上声明内容类型

  ...
  $headers .= 'Content-type: text/html; charset=utf-8' . "\r\n";
  $headers .= "From:" . $from;

消息正文可以有您想要的任何内联样式。

那么您得到的
输出是什么呢??您的文本是否显示为粗体?
的输出是什么??您的文本是否粗体?您不会在生产中使用suppress(
@
),对吗?非常感谢。我想问你另一个问题是,如果我放置背景图像,它必须是链接还是像往常一样设置背景url?你可以将背景url设置为图像的完整路径:
可以这样放置吗<代码>不,我不这么认为。您需要图像的绝对路径。但您不会在生产中使用suppress(
@
),对吗?非常感谢。我想问你另一个问题是,如果我放置背景图像,它必须是链接还是像往常一样设置背景url?你可以将背景url设置为图像的完整路径:
可以这样放置吗<代码>不,我不这么认为。您需要图像的绝对路径。