dousi2251
dousi2251
2018-05-14 10:40

如何使用PHP在邮件中添加超链接

已采纳

I have to add hyperlink into my mail function. But when there has been sent an email, I dont get the tag, but the fully code like "click here" I just want an email without seeing the tag in my mail. This is the code I am using:

function stuurMail($email, $verificationCode)
{
    $tekst = "";
    $receiver= $email;
    $topic = "Bevestiging aanmelding EenmaalAndermaal";
    $tekst .= "Bedankt voor uw aanmelding!
Om gebruik te kunnen maken van het platform, dient u via het onderstaande link uw account te activeren!
";
    $tekst .= "<a href=\"test_functie.php\">http://test.nl/test.php?check=$verificationCode</a>";
    $header = "From: blabla@gmail.com";
    mail($receiver, $topic, $tekst, $header);
}
  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享
  • 邀请回答

1条回答

  • doq91130 doq91130 3年前

    You should make the email to be a HTML email and not a plain-text one. Update your header this way:

    $header = "From: blabla@gmail.com
    Content-type: text/html; charset=iso-8859-1";
    
    点赞 8 评论 复制链接分享

相关推荐