PHP: Send mail with link
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";
$hea开发者_如何学运维ders .= '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!
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)
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?
Your code is working properly. I sent a mail to my account. And, no, it wasn't in the spam folder.
精彩评论