使用php邮件设置邮件地址的样式
我尝试用php发送电子邮件。当我收到苹果邮件时,我看到了带有链接的地址:蓝色和下划线。也许其他邮件服务也会出现这种情况。如何在php发送的邮件中设置邮件地址的样式?。我想要控制权使用php邮件设置邮件地址的样式,php,email,Php,Email,我尝试用php发送电子邮件。当我收到苹果邮件时,我看到了带有链接的地址:蓝色和下划线。也许其他邮件服务也会出现这种情况。如何在php发送的邮件中设置邮件地址的样式?。我想要控制权 <?php $to = htmlspecialchars("info@example.com"); $subject = htmlspecialchars("Subject"); $message = " <html> <head> <title>HTML email<
<?php
$to = htmlspecialchars("info@example.com");
$subject = htmlspecialchars("Subject");
$message = "
<html>
<head>
<title>HTML email</title>
</head>
<body>
<table>
<tr>
<td style='outline:0; text-decoration: none;'>
info@example.com</td>
</tr>
</table>
</body>
</html>
";
$headers = "MIME-Version: 1.0" . "\r\n";
$headers .= "Content-type:text/html;charset=UTF-8" . "\r\n";
$headers .= 'From: <info@example2.com>' . "\r\n";
mail($to, $subject, $message, $headers);
?>
包裹电子邮件地址
<a href="mailto:info@example.com">info@example.com</a>
包裹电子邮件地址
<a href="mailto:info@example.com">info@example.com</a>
您可以在中添加标记。并简单地作为一个普通的html页面工作。 在以前的项目中尝试过,效果很好
<?php
$to = htmlspecialchars("info@example.com");
$subject = htmlspecialchars("Subject");
$message = "
<html>
<head>
<style>
td{outline:0; text-decoration: none;}
p{font-weight:bold;color:red;}
a{text-decoration: none; border: 0; color: red; font-weight:bold;}
</style>
<title>HTML email</title>
</head>
<body>
<table>
<tr>
<td><a href="mailto:info@example.com">info@example.com</a></td>
</tr>
</table>
<p>My paragraph has style !</p>
</body>
</html>
";
$headers = "MIME-Version: 1.0" . "\r\n";
$headers .= "Content-type:text/html;charset=UTF-8" . "\r\n";
$headers .= 'From: <info@example2.com>' . "\r\n";
mail($to, $subject, $message, $headers);
?>
您可以在中添加标记。并简单地作为一个普通的html页面工作。 在以前的项目中尝试过,效果很好
<?php
$to = htmlspecialchars("info@example.com");
$subject = htmlspecialchars("Subject");
$message = "
<html>
<head>
<style>
td{outline:0; text-decoration: none;}
p{font-weight:bold;color:red;}
a{text-decoration: none; border: 0; color: red; font-weight:bold;}
</style>
<title>HTML email</title>
</head>
<body>
<table>
<tr>
<td><a href="mailto:info@example.com">info@example.com</a></td>
</tr>
</table>
<p>My paragraph has style !</p>
</body>
</html>
";
$headers = "MIME-Version: 1.0" . "\r\n";
$headers .= "Content-type:text/html;charset=UTF-8" . "\r\n";
$headers .= 'From: <info@example2.com>' . "\r\n";
mail($to, $subject, $message, $headers);
?>
尝试使用链接并应用css这与邮件服务无关,但与您用来阅读收到的邮件的客户端无关。尝试使用链接并应用css这与邮件服务无关,但与您用来阅读收到的邮件的客户端无关。我以前尝试过,但没有成功。我再次尝试复制粘贴您的,并改变地址,并再次,没有区别。我看到它的蓝色和下划线,你需要创建自己的css。我已经编辑了代码。请再试一次,好的!它工作得很好。但我不明白。我认为我应该使用内联css来设计邮件的样式。是这样吗?为什么会出现这种异常?您使用的是内容类型:text/html;因此,它将把它解释为html/css。如果有用,请选择答案;)<代码>这会打断您的字符串连接<代码>“。我以前试过,但没有成功。我再次尝试复制粘贴您的,并改变地址,并再次,没有区别。我看到它的蓝色和下划线,你需要创建自己的css。我已经编辑了代码。请再试一次,好的!它工作得很好。但我不明白。我认为我应该使用内联css来设计邮件的样式。是这样吗?为什么会出现这种异常?您使用的是内容类型:text/html;因此,它将把它解释为html/css。如果有用,请选择答案;)<代码>这会打断您的字符串连接“
。在某种程度上你是对的。我已经测试过,问题不是像vieroli说的那样使用内联css或不使用内联css。解决方案是使用a href并设置它的样式(内联或不内联)。因此,这也行得通:在某种程度上你是对的。我已经测试过,问题不是像vieroli说的那样使用内联css或不使用。解决方案是使用a href并设置它的样式(内联或非内联)。因此,这也适用于: