本文介绍了如何以表格格式在php中发送邮件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
当用户以表格格式注册我们的网站时,我想向用户发送邮件,但是我无法从数据库中获取记录.该怎么做.
i want to send mail to the user when they register our site in a tabular format but i am unable to fetch the record from database.how can do it.
public function sendMailRegisterToUser()
{
$userid = @$_SESSION['front_user_id'];
$query = "SELECT * FROM `user` WHERE `id` = '$userid' ";
$db_query = mysql_query($query);
$row = @mysql_fetch_assoc($db_query);
$first = $row['f_name'];
$last = $row['l_name'];
$username = $row['username'];
$password = $row['password'];
$subject = '[xyz.com] Account Created';
$message = '<table width="100%"cellspacing="1" cellpadding="1" bgcolor="#CCCCCC">
<tr>
<td width="483" height="50"><font color="#CC3333">abc</font></td>
<td width="208" height="50" align="center"><font color="#CC3333">Tech Support
<br />1-111-979-1234<br />
[email protected]</font></td>
<td width="277" height="50" align="right"><font color="#CC3333">Customer Service <br />
1-111-979-0400 <br />
[email protected]</font></td>
</tr>
<table width="100%"cellspacing="1" cellpadding="1" bgcolor="#CCCCCC">
<td width="483" align="center"><font color="#CC3333">Congratulations on your purchase</font>
</td>
</table>
</table>
<TABLE BORDER="1" WIDTH="100%">
<TR>
<TD WIDTH=460>
<table width="460" border="1" cellspacing="1" cellpadding="1">
<tr bordercolor="#FFFFFF">
<td width="244" bgcolor="#000000"> <font color="#FFFFFF">Your Personal info registered with us - </font></td>
</tr>
<tr bordercolor="#FFFFFF">
<td > Your Personal Detail are </td>
</tr>
<tr>
<td> First Name : </td>
<td>$message.=$first</td>
</tr>
<tr>
<td> Last Name : </td>
<td>$last</td>
</tr>
<tr>
<td> Email : </td>
<td><?php echo $username ; ?></td>
</tr>
<tr>
<td><strong>Primary contact </strong>: </td>
<td></td>
</tr>
<tr>
<td><strong>Secondary contact </span></strong>: </td>
<td> </td>
</tr>
</table>
<TD WIDTH="502">
<table width="502" border="1" style="margin-top:-90px;" >
<tr>
<td width="244" bgcolor="#000000"> <font color="#FFFFFF">Your subscription details are - </font></td>
</tr>
<tr>
<td width="244"> Account Number :</td>
<td width="244"> </td>
</tr>
<tr>
<td width="244"> Access code :</td>
<td> </td>
</tr>
<tr>
<td bgcolor="#CCCCCC"> Product subscribed to </td>
<td> </td>
</tr>
<tr>
<td> Product Name :</td>
<td> </td>
</tr>
<tr>
<td> Activation Date :</td>
<td></td>
</tr>
<tr>
<td> Expiry Date :</td>
<td> </td>
</tr>
<tr>
<td bgcolor="#CCCCCC"> Payment Details </td>
<td> </td>
</tr>
<tr>
<td> Amount Charged :</td>
<td></td>
</tr>
</table>
</TD>
</TD>
</TR>
</TABLE>
';
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers.= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
$headers.= 'From: <[email protected]> '."\n";
$to = $username;
@mail($to,$subject,$message,$headers);
return;
}
<pre lang="PHP">
推荐答案
这篇关于如何以表格格式在php中发送邮件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!