ขอถามเรื่องส่งเมล์ ใช้โปรแกรมจำลองการส่งเมล์ ArGoSoft Mail Server .NET Free
ใช้โปรแกรมจำลองการส่งเมล์ ArGoSoft Mail Server .NET Free
ฟอร์มรับข้อมูล
<form action="phpSendMailUploadAttach.php" method="post" enctype="multipart/form-data" name="frmMain">
<table width="550" border="1" bgcolor="#FFFFFF" align="center">
<tr bgcolor=#FFCCFF height="30">
<td align=center valign=top colspan=2 ><br>ส่งเมล์ถึงสมาชิกที่นิยมสินค้าประเภท
<?
$type_id = $_SESSION['ptype_id'] ;
$ssql="SELECT producttype.producttype_name
FROM producttype
WHERE producttype.producttype_id = '$type_id' ";//".$_POST['ptype_id']."
$rsproducttype = mysql_query($ssql);
While (list($producttype_name) = mysql_fetch_array($rsproducttype))
{
echo $producttype_name;
}//while
?>
</td>
</tr>
<tr>
<td align="center" width="200" bgcolor=#FFCCFF>TO</td>
<td ><textarea name="txtTo" value='' cols="65" rows="4" readonly=true>
<?php
//echo $mid;
$id = explode(',',$mid);
$n = count($id);
for($i=0; $i<$n; $i++){
$strsql="SELECT DISTINCT member.member_id, member.member_email FROM member
WHERE member.member_id = '$id[$i]'
GROUP BY member.member_id
";
$rsmember = mysql_query($strsql);
$rsmemberrows = mysql_num_rows($rsmember);
while (list($member_id, $member_email) = mysql_fetch_array($rsmember)) {
echo $member_email.",";
} //while
} //for
?>
</textarea>
</td>
</tr>
<tr>
<td align="center" bgcolor=#FFCCFF>Subject</td>
<td><input name="txtSubject" type="text" size=65></td>
</tr>
<tr>
<td align="center" bgcolor=#FFCCFF>Description</td>
<td><textarea name="txtDescription" cols="65" rows="6"></textarea></td>
</tr>
<tr>
<td align="center" bgcolor=#FFCCFF>Form Name</td>
<td><input name="txtFormName" type="text" size=60 value="DUDENSHOP"></td>
</tr>
<tr>
<tr>
<td align="center" bgcolor=#FFCCFF>Form Email</td>
<td><input name="txtFormEmail" type="text" size=60 value="[email protected] "></td>
</tr>
<tr>
<td align="center" bgcolor=#FFCCFF>Attachment</td>
<td><input name="fileAttach" type="file" size=40></td>
</tr>
<tr bgcolor=#FFCCFF height="30">
<td colspan="2" align="center"><input type="submit" name="Submit" value="Send" size=15> </td>
</tr>
</table>
<br>
<br>
<br>
</form>
โค้คที่ส่งเมล์
<?
$strTo = $_POST["txtTo"];
$strSubject = $_POST["txtSubject"];
$strMessage = nl2br($_POST["txtDescription"]);
//*** Uniqid Session ***//
$strSid = md5(uniqid(time()));
$strHeader = "";
$strHeader .= "From: ".$_POST["txtFormName"]."<".$_POST["txtFormEmail"].">\nReply-To: ".$_POST["txtFormEmail"]."";
$strHeader .= "MIME-Version: 1.0\n";
$strHeader .= "Content-Type: multipart/mixed; boundary=\"".$strSid."\"\n\n";
$strHeader .= "This is a multi-part message in MIME format.\n";
$strHeader .= "--".$strSid."\n";
$strHeader .= "Content-type: text/html; charset=windows-874\n";
$strHeader .= "Content-Transfer-Encoding: 7bit\n\n";
$strHeader .= $strMessage."\n\n";
//*** Attach ***//
if($_FILES["fileAttach"]["name"] != "")
{
$strFilesName = $_FILES["fileAttach"]["name"];
$strContent = chunk_split(base64_encode(file_get_contents($_FILES["fileAttach"]["tmp_name"])));
$strHeader .= "--".$strSid."\n";
$strHeader .= "Content-Type: application/octet-stream; name=\"".$strFilesName."\"\n";
$strHeader .= "Content-Transfer-Encoding: base64\n";
$strHeader .= "Content-Disposition: attachment; filename=\"".$strFilesName."\"\n\n";
$strHeader .= $strContent."\n\n";
}
//$flgSend = @mail($strTo,$strSubject,null,$strHeader); // @ = No Show Error //
//if($flgSend)
if(mail($strTo,$strSubject,null,$strHeader))
{
echo "Email Sending.";
}
else
{
echo "Email Can Not Send.";
}
?>
รันผลแล้วเป็นแบบนี้ค่ะ ผู้รู้ช่วยดูให้หน่อยค่ะ
Warning: mail() [function.mail]: SMTP server response: 501 User not local. Authentication required to for relay in C:\AppServ\www\duden\report\phpSendMailUploadAttach.php on line 41
Email Can Not Send. Tag : - - - -
Date :
2010-05-14 13:50:42
By :
chumpoo
View :
1217
Reply :
1
Load balance : Server 02