I need to send html email to the emails i collect from Textboxes. my code is a follows.
I am having following problems.
[LIST=1]
[]The email is not sent in HTML format.
[]The “[COLOR=darkred]from[/COLOR]” address on the recievers email client appears as " [COLOR=darkred]senders[/COLOR] [COLOR=darkred]email [/COLOR][COLOR=darkred]address@mycurrent[/COLOR][COLOR=darkred] webhost account[/COLOR]". I want it to only show the senders email address.
[/LIST]my code is a follows.
<?php
for ($i = 1; $i <= 10; $i++)
{
$name = $_POST['n'.$i];
$to = $_POST['e'.$i];
$sname=$_POST['sname'];
$semail=$_POST['semail'];
$msg=$_POST['message'];
$card=$_POST['cardname'];
$today=time();
$time= ($today + $i);
if($to == ''){echo "";}else{
$headers = 'MIME-Version: 1.0' . "
";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "
";
$headers = "From:" .$semail;
$subject = $sname . "has sent you an ecard from www.bestwishes.com.np ";
$message = "Dear " .$name . ", You have recieved an ecard from" .$sname." <\br>
In order to pick your greeting, please click on the following link: <a href ='www.bestwishes.com.np/pickup.php?action=view&personalize=".$time."'>www.bestwishes.com.np/pickup.php?action=view&personalize=".$time."</a> </br>
If the above link doesnot work, Try visiting <a href= 'www.bestwishes.com.np'>http://www.bestwishes.com.np</a> and insert your card id ".$time. " and click on Pick Up Button
Best Regards
www.bestwishes.com.np" ;//*/
if(mail($to, $subject, $message, $headers ))
{
echo "Dear ".$sname.",</br>
Your card has been sent to ".$email."
</br> With following Personalized no. " .$time. "
</br>";
}
else
{
echo "Mail could not be sent to specified Email Address";
}
//$today=time();
//echo $today;
}//else {echo "";}
}
?>
Sure always happy to help man !! Well my code might not be upto the mark . And HTML might be just too long. But if it helps any other user like me, I’ll be more than happy.
<?php
for ($i = 1; $i <= 10; $i++)
{
$name = $_POST['n'.$i];
$to = $_POST['e'.$i];
$sname=$_POST['sname'];
$semail=$_POST['semail'];
$msg=$_POST['message'];
$card=$_POST['cardname'];
$today=time();
$time= ($today + $i);
if($to == ''){echo "";}else{
//$personalize=random_string('unique', 10);
// To send HTML mail, the Content-type header must be set
$headers = 'MIME-Version: 1.0' . "
";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "
";
$headers .= "From: $semail
";
$subject = $sname . "has sent you an ecard from www.bestwishes.com.np ";
$message = '<html>
<head>
<title>..:: Bestwishes.com.np ::.. The best way to express</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<link href="http://www.bestwishes.com.np/css/d&i.css" rel="stylesheet" type="text/css">
<body>
<table width="400" border="0" cellspacing="0" cellpadding="0">
<tr align="center" valign="middle" bgcolor="#000000">
<td colspan="3"><font color="#FFFFFF" size="2" face="Verdana, Arial, Helvetica, sans-serif">Bestwishes.com.np
<br>
</font></td>
</tr>
<tr>
<td width="5%" bgcolor="#000000"> </td>
<td width="90%" valign="top" bgcolor="#FFFFFF">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td class="bodygreen"> Dear ' .$name . ',<br>
<br>
</td>
</tr>
<tr>
<td><div align="center" class="bodyblue">You recieved an ecard from
' .$sname.'. <br>
Click Pick Up Button to pick your card.<br>
<br>
</div></td>
</tr>
<tr>
<td><div align="center"><a href="www.bestwishes.com.np/pickup.php?action=view&personalize='.$time.'"><img src="http://www.bestwishes.com.np/pikup.gif" width="150" height="40" border="0"></a></div></td>
</tr>
<tr>
<td class="bodyblue"><div align="center"><br>
If the button does not work. Visit <a href="http://www.bestwishes.com.np">http://www.bestwishes.com.np</a><br>
And Enter your PCN<font color="#CC0000"> '.$time. ' </font>and
Click on Pick Up Card Button.<br>
<br>
</div></td>
</tr>
</table>
</td>
<td width="5%" bgcolor="#000000"> </td>
</tr>
<tr bgcolor="#000000">
<td colspan="3" class="bodyarticle">
<div align="center"><font color="#FFFFFF" size="1"><br>
</font></div></td>
</tr>
</table>
</body>
</html>' ;//*/
if(mail($to, $subject, $message, $headers ))
{
echo "Dear ".$sname.",</br>
Your card has been sent to " . $to . "
</br> With following Personalized no. " .$time. "
</br>";
}
else
{
echo "Dear ".$sname.",</br>
Your card could not be sent to " . $to ."Please Try again";
}
//$today=time();
//echo $today;
}//else {echo "";}
}
?>