php - html email issue for a tag value
I am sending html email to the client via php mail function. while & sign shown in bold creating problems in email replacing ! %20 something like characters within my ids such as below(in bold).
Below is my code. $to = '[email protected]';
// subject $subject = 'test'; //message $message.='<html><head><meta charset="UTF-8" /></head><body><p><a href="http://test.com/test-page.php?id=abcd1234&cat_id=23" target="_blank">Wine **&** Dine Offers</a></p></body></html>'; // To send HTML mail, the Content-type header must be set $headers = 'MIME-Version: 1.0' . "\r\n"; $headers .= 'Content-type: text/html; charset=UTF-8' . "\r\n"; // Additional headers $headers .= 'To: test <[email protected]>' . "\r\n"; $headers .= 'From: test user <[email protected]>' . "\r\n"; // Mail it mail($to, $subject, $message, $headers);
After sending mail i am getting ! and %20 like characters in email. I also tried & except & in email but no use still ! adding within my email html.
on the incoming parameters. Example:
I think you should encode the URL on the email. Plus, you probable have magic_quotes_gpc "on" that is not recommended.
I always use PHPMailer, it saves a lot of work and helps on these problems
I changed the encoding settings on phpmailer to use base64 encoding using
This solved my problem.
As there is issue for HTML mail meassage exceeds length 998 or something i got the above solution to it. :)