在這裏我有一個代碼,如從index.php獲取數據,如果用戶輸入數據,它將顯示如表格,以及它應該去電子郵件到一些預定義的郵件。但我在這裏獲取數據動態,我試圖用$ _REQUEST和$ _POST兩種方法來獲取數據,但在郵件功能我試圖改變消息參數,但由PHP標記它沒有采取和顯示一些語法錯誤。如何發送HTML動態表格作爲郵件在PHP?
請到通過代碼在這裏
<?php
$to="[email protected]";
$fn="Fisrt Name";
$ln="Last Name";
$name=$fn.' '.$ln;
$from="[email protected]";
$subject = "Welcome to Website";
include('newsmtp/smtpwork.php');
?>
<?php
$message = 'Dear $firstName,
Your Welcome Message.'.'
<table border=1>
<tr>
<td>First Name:</td>
<td><?php $firstName=$_POST['firstname'];
echo $firstName;?></td>
</tr>
<tr>
<td>Last Name:</td>
<td><?php $lastname=$_POST['lastname'];
echo $lastname;?></td>
</tr>
<tr>
<td>Title:</td>
<td><?php $title=$_POST['title'];
echo $title;?></td>
</tr>
<tr>
<td>Address:</td>
<td><?php $address=$_POST['address'];
echo $address;?></td>
</tr>
<tr>
<td>Phone Number:</td>
<td><?php $phone=$_POST['phone'];
echo $phone;?></td>
</tr>
<tr>
<td>Course Name:</td>
<td><?php $course=$_POST['coursename'];
echo $course;?></td>
</tr>
<tr>
<td>Website:</td>
<td><?php $website=$_POST['website'];
echo $website;?></td>
</tr>
</table>
Thanks
xxxxxxxxxxxx
';
?>
使用[phpMailer](http://code.google.com/a/apache-extras.org/p/phpmailer/)。網站上提供的說明。 – SDC