PHP: Send mail with link

折月煮酒 提交于 2019-12-08 05:13:05

问题


Im using following php code:

$mailacc = "example@example.com";

$subject = "Hello";

$message = "
<html>
<head>
  <title>Test Mail</title>
</head>
<body>
    <p><a href='http://stackoverflow.com'>Open Link</a></p>
</body>
</html>
";

$headers  = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
$headers .= 'From: Noreply <noreply@example.com>' . "\r\n";

$mail = mail($mailacc, $subject, $message, $headers);

But it dosent send the mail, when I remove the link and put in some text it workes. Why can't I have a link in my message? PS: $mailacc is my real email account.

Thx!


回答1:


If it doesn't send the mail, it's an issue with the server itself.. it is unable to send mails. (Or otherwise: check the spam-folder)




回答2:


I've tested your exact code on my server, and I received the message fine.

Are you sure that your spam filter isn't detecting the link and sending it to a 'junk mail' folder?




回答3:


Your code is working properly. I sent a mail to my account. And, no, it wasn't in the spam folder.



来源:https://stackoverflow.com/questions/7661183/php-send-mail-with-link

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!