我試圖發送這個html郵件,並且由於某種原因,當主體中存在鏈接時它不會發送。這兩個文件之間的唯一區別似乎是它在主體中有一個鏈接。如果我把相同的東西放在主題中,它會發送正常。當主體中有一個URL時,PHP郵件將不會發送
完美的作品:
//mail body and subject
$mail_body = "Test Email with no link.";
$subject = "Test email with no link";
//recipient
$recipient = "[email protected]";
//headers to send HTML email
$header = "MIME-Version: 1.0\n" ;
$header = $header . "Content-Type: text/html; charset="\iso-8859-1\"\n";
$header = $header . 'From: [email protected]';
//send the message
mail($recipient, $subject, $mail_body, $header) or die('mail could not be sent'); //mail command :)
echo('Good Test');
不起作用:
//mail body and subject
$mail_body = "Test Email with link. <a href=\"http://www.google.com\">google</a>";
$subject = "Test email with with link. ";
//recipient
$recipient = "[email protected]";
//headers to send HTML email
$header = "MIME-Version: 1.0\n" ;
$header = $header . "Content-Type: text/html; charset=\"iso-8859-1\"\n";
$header = $header . 'From: [email protected]';
//send the message
mail($recipient, $subject, $mail_body, $header) or die('mail could not be sent'); //mail command :)
echo('Bad Test');
界面污物,我不知道爲什麼反斜槓沒貼了,但他們都在碼。它仍然在代碼中使用反斜槓。我把它們放回上面的例子中,但我擔心這太遲了,現在每個人都會認爲這是常見的反斜槓問題。不是。當它,爲什麼它沒有粘貼。 – 2012-03-04 06:53:37
電子郵件地址???你的意思是說「url」嗎? – jmort253 2013-03-04 17:02:05