Php gmail信息中的超链接
我正在尝试从php smtp发送电子邮件。 消息的一部分是Php gmail信息中的超链接,php,email,smtp,gmail,Php,Email,Smtp,Gmail,我正在尝试从php smtp发送电子邮件。 消息的一部分是 但我在收到的gmail信息中没有看到超链接。 电子邮件看起来就像上面的字符串一样。 如何获取超链接 php代码如下所示: $body = "Something including the above code"; $headers = 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n"; $he
但我在收到的gmail信息中没有看到超链接。
电子邮件看起来就像上面的字符串一样。
如何获取超链接
php代码如下所示:
$body = "Something including the above code";
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
$headers = array( 'From' => $from, 'To' => $email, 'Subject' => $subject );
$smtp = Mail::factory('smtp', array(... host port uth username password ... ));
$mail = $smtp->send($email, $headers, $body)
您应该在电子邮件中添加标题 例如:
$headers = 'Content-type: text/html;';
$message = <<<EOD
<h1> Hello World <h1>
<a href="https://search.yahoo.com/">goto Yahoo</a>
<a href="https://www.google.com/">goto Google</a>
EOD;
$result = mail('your-email@gmail.com', 'hello world', $message,$headers);
if($result){
echo 'message sent';
}else{
echo 'failure';
}
$headers='Content-type:text/html;';
$message=