Hi all,

I am a newbie in php and is developing a cms. I am verifying the email address of the new user when creating an account on a site. The email goes to the email address with activation code of the account, but this email is not having the design i have given to it. I have designed it like a newsletter and created a small HTML of it. But this HTML email is sending the HTML tags which i have given in the '$message' variable. Rather it should be in a design not the HTML tags.

I am sending you the code, please check and tell me where i am going wrong. The code goes below:-

<?php 

$link = "http://www.multisoftintl.com/php/confirmation.php?passkey=$confirm_code";

// send e-mail to ...
$to = $email;

// Subject
$subject="Your confirmation link here";

// From
$headers = "from: your name <your email>";
$headers .= "MIME-Version: 1.0\r\n"; 
$headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n";

// Message
$message = '<html><body>';
$message .= '<table width="587" border="0" cellspacing="0" cellpadding="0" align="center" >\r\n';
$message .= '<tr><td width="564" height="88" align="center" bgcolor="#3E709E"><a href="http://multisoftintl.com"><img 						src="images/logo.gif" width="330" height="88" alt="Multisoft International"/></a></td></tr>\r\n';
$message .= '<tr><td height="32" align="center" background="images/hover_bg.gif"><font face="Verdana, Arial, Helvetica, sans-serif" 	color="#FFFFFF"><b>Your Comfirmation link From Multisoft International</b></font></td></tr>\r\n';
$message .= '<tr><td><font face="Verdana, Arial, Helvetica, sans-serif" color="#666666"><h4>Hi,</td></tr>\r\n';

$message .= '<tr><td><font face="Verdana, Arial, Helvetica, sans-serif" color="#666666"><h5>Multisoft International is thankful to you for opening your account! <br /> This email is sent to you confirm your email. Please click the activation code given below!</h5></font></td></tr>\r\n';
    
$message .=  "<tr><td><h5><b> <?php echo $link ?> </b></h5></font</td></tr>\r\n";
$message .=  '<tr><td><font face="Verdana, Arial, Helvetica, sans-serif" color="#666666"><h5><b>Regards!</b></h5></font></td></tr>\r\n';
$message .=  '<tr><td><font face="Verdana, Arial, Helvetica, sans-serif" color="#666666"><h5><b>Bye.</b></h5></font></td></tr>\r\n';
$message .=  '</table>\r\n';
$message .=  '</body></html>';
/*$message.="Click on this link to activate your account \r\n";*/

// send email
$sentmail = mail($to,$subject,$message,$header);

}

// if not found 
else {
echo "Not found your email in our database";
}

// if your email succesfully sent
if($sentmail){
$msg = "Your Confirmation link Has Been Sent To Your Email Address.";
}
else {
$err = "Cannot send Confirmation link to your e-mail address";
}


?>

Please help me in this problem!
Thanks.
Best Regards!
Bye.

Recommended Answers

All 3 Replies

Hi,

Try changing the double quotes to single quotes in below part.

// From
$headers = 'from: your name <your email>';
$headers .= 'MIME-Version: 1.0'. "\r\n"; 
$headers .= 'Content-Type: text/html; charset=ISO-8859-1'. "\r\n";

ok, i have changed the headers string quotes from double to single. But it did not change the results. The email function is still sending the HTML tags rather than the table design.

Any new suggestion!?

This is the email i am receiving after making the changes to the headers you asked me to do. Look at the HTML tags in my inbox.

<html><body><table width="587" border="0" cellspacing="0" cellpadding="0" align="center" >
<tr><td width="564" height="88" align="center" bgcolor="#3E709E"><a href="http://multisoftintl.com"><img src="images/logo.gif" width="330" height="88" alt="Multisoft International"/></a></td></tr>
<tr><td height="32" align="center" background="images/hover_bg.gif"><font face="Verdana, Arial, Helvetica, sans-serif" color="#FFFFFF"><b>Your confirmation link From Multisoft International</b></font></td></tr>
<tr><td><font face="Verdana, Arial, Helvetica, sans-serif" color="#666666"><h4>Hi,</td></tr>
<tr><td><font face="Verdana, Arial, Helvetica, sans-serif" color="#666666"><h5>Multisoft International is thankful to you for opening your account! <br /> This email is sent to you confirm your email. Please click the activation code given below!</h5></font></td></tr>
<tr><td><h5><b> <?php echo http://www.multisoftintl.com/php/confirmation.php?passkey=994b00c72c0aaa64330225c8df7ff9d3 ?> </b></h5></font</td></tr>
<tr><td><font face="Verdana, Arial, Helvetica, sans-serif" color="#666666"><h5><b>Regards!</b></h5></font></td></tr>
<tr><td><font face="Verdana, Arial, Helvetica, sans-serif" color="#666666"><h5><b>Bye.</b></h5></font></td></tr>
</table>
</body><

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.