Mail functionality with X-Mailer: PHP/' . phpversion() is not supporting content type html

StackOverflow https://stackoverflow.com/questions/14214333

  •  14-01-2022
  •  | 
  •  

Question

In my registration page, I used the below coding for mail content.

$to =$email;

$subject = "Welcome to our site. Verify your Email address";

$body= "<table>

Dear $firstname $lastname,


Welcome to site name!

You have signed up for a new user account at JumpingEyes.  Please click the following activation link to complete your user registration process.

Your Email: $email

Activation Link:

<

$jeob->urlpath/activelink.php?status=1&mailid=$email

> 

Please Note: If you encounter any problems clicking on this link, please try typing it manually into your browser. Once you have been authenticated, you will have access to your account.

Sincerely,



site Team

*This is a system generated email - PLEASE DO NOT reply to this email*</table>";

$headers = 'From: usersupport@JumpingEyes.com' . "\r\n" .
    'X-Mailer: PHP/' . phpversion();

mail($to,$subject,$body,$headers);

        $display = "<div class='error'>Thank you for creating a new account with JumpingEyes.com.  A confirmation email has been sent to $email for you to activate your new account<br><span style='font-size:12px;font-weight:normal;'><a href='index.php'>Continue....</span></a></div>";

If we received the mail it shows the following output and it is not considering the html tag. If we remove the table tag it does not sending the mail.

And I also used $headers[] = "Content-type: text/plain; charset=iso-8859-1"; but after tat the mail functionality is not working. Anybody can help me to solve this problem.

<table>

Dear Nandhu D,

Welcome to site!

You have signed up for a new user account at JumpingEyes.  Please click the following activation link to complete your user registration process.

Your Email: rithikapsks@gmail.com

Activation Link:

<

http://domain.com//activelink.php?status=1&mailid=rithika@gmail.com

>

Please Note: If you encounter any problems clicking on this link, please try typing it manually into your browser. Once you have been authenticated, you will have access to your account.

Sincerely,

siteTeam

*This is a system generated email - PLEASE DO NOT reply to this email*</table>
Was it helpful?

Solution

Replace headers with below and try..

$headers  = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
$headers .= 'From: Mailer <mailer@example.com>' . "\r\n";
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top