I'm trying to send this html email and for some reason it won't send when there's a link in the body. The only difference between these two files seems to be that one has a link in the body. If I put the same thing in the subject it sends fine.
Works perfectly:
//mail body and subject
$mail_body = "Test Email with no link.";
$subject = "Test email with no link";
//recipient
$recipient = "myemail@mydomain.com";
//headers to send HTML email
$header = "MIME-Version: 1.0
" ;
$header = $header . "Content-Type: text/html; charset="\iso-8859-1\"
";
$header = $header . 'From: admin@test.com';
//send the message
mail($recipient, $subject, $mail_body, $header) or die('mail could not be sent'); //mail command :)
echo('Good Test');
Does Not work:
//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 = "myemail@mydomain.com";
//headers to send HTML email
$header = "MIME-Version: 1.0
" ;
$header = $header . "Content-Type: text/html; charset=\"iso-8859-1\"
";
$header = $header . 'From: admin@test.com';
//send the message
mail($recipient, $subject, $mail_body, $header) or die('mail could not be sent'); //mail command :)
echo('Bad Test');