将图像放在电子邮件标题中

时间:2015-06-01 02:52:35

标签: codeigniter

如何在 hello 之前放置图片标题?你能帮我吗?

这是我的观点:

<body>
<p>Hello, <?php echo $first_name; ?> <?php echo $last_name; ?></p>

<p>Please click the link below to reset your password within 24 hours :</p>

<p>
<a href="<?php echo base_url(); ?>recover/response/<?php echo $secret; ?>/">Click here to reset password</a>
</p>

<p>
Regards,<br>
Customer Service.
</p>    
</body>

1 个答案:

答案 0 :(得分:0)

试试这个

$to = '';//Assign your Mail
$subject = 'Email Subject';

$message = '<html><body>';
$message .= '<img src="http://example.com/123.png" alt="Your Image" />';//Image
$message .= '<p>Hello, <?php echo $first_name; ?> <?php echo $last_name; ?></p>';
$message .= '<p>Please click the link below to reset your password within 24 hours :</p>';
$message .= '<p><a href="<?php echo base_url(); ?>recover/response/<?php echo $secret; ?>/">Click here to reset</a></p>';
$message .= '<p>Regards,<br>Customer Service.</p>';
$message .= "</body></html>";

在发送标题之前

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

发送邮件

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