Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Gmail removing the links tags , how to avoid this

I'm trying to send with function mail(); rich text containing links ; I'm sending this kind of code...

 Please,  access <a href="http://www.site.md/contact/en/"> Contact </a> to send all these information

throw firebug i can see that link tags was removed , code becoming like this

 Please,  access <a>Contact</a> to send all these information

I need this script , after banning the person who violated rules , to send email to tell the reason why we banned him . On another email services email comes without problems , what is my mistake , sorry for my English , down i'll show a part from script for sending email , the important one..

     // Set and wordwrap message body
 $body = "From: $name\n\n";
 $body .= "Message: $message";
 $body = wordwrap($body, 70);

 // Build header

 $headers  = 'MIME-Version: 1.0' . "\r\n";
 $headers .= 'Content-type: text/html; charset=utf-8' . "\r\n";

 $headers .= "From: $email\n";
 if ($cc == 1) {
  $headers .= "Cc: $email\n";
 }
 $headers .= "X-Mailer: PHP/Contact";


 // Send email
 if(!@mail($to, $subject, $body, $headers)) { 
  echo '<b> ERROR ! </b> Unfortunately, a server issue prevented delivery of your message<br />'; }
like image 692
mIRU Avatar asked Mar 04 '10 16:03

mIRU


1 Answers

Unless you are doing something to $body in the code you have not posted here, my guess is that it is wordwrap() that causes the problem. In the php manual is a user-contributed function which might help: http://www.php.net/manual/en/function.wordwrap.php#89782

like image 150
jah Avatar answered Oct 06 '22 06:10

jah