File : sendmail.asp. ID : 2703
Skin : Default | Sons-of-obsidian | Sunburst | Highlighter | Frame
<! refer from http://www1.domaindlx.com/aspemailsample.html>
<body><b>Sendmail.asp</b> version 1.0<br>
<form action=sendmail.asp method=post>
SMTP Host<select name=gethost>
<option value=mail.loxinfo.co.th selected>mail.loxinfo.co.th
<option value=mail.a-net.net.th>mail.a-net.net.th
<option value=bkk1.asiaaccess.net.th>bkk1.asiaaccess.net.th
<option value=classic.asianet.co.th>classic.asianet.co.th
<option value=mail.cscoms.com>mail.cscoms.com
<option value=mail.linethai.co.th>mail.linethai.co.th
<option value=mail.fareast.net.th>mail.fareast.net.th
<option value=mail.idn.co.th>mail.idn.co.th
<option value=smtp.infonews.co.th>smtp.infonews.co.th
<option value=mozart.inet.co.th>mozart.inet.co.th
<option value=smtp.samart.co.th>smtp.samart.co.th
<option value=mail.wnet.net.th>mail.wnet.net.th
<option value=smtp.softhome.net>smtp.softhome.net
</select><br>
From E-mail:<input type=text name=femail>
From Name:<input type=text name=fname>
Reply to E-mail:<input type=text name=remail><br>
To E-mail:<input type=text name=temail>
To Name:<input type=text name=tname><br>
CC E-mail:<input type=text name=ccemail>
BCC E-mail:<input type=text name=bccemail><br>
Subj:<input type=text name=subj size=50><br>
<textarea name=msg rows=10 cols=80>
</textarea><br>
<br><input type=submit value=Send>
</form>
<%
gethost = request.form("gethost")
femail = request.form("femail")
fname = request.form("fname")
remail = request.form("remail")
temail = request.form("temail")
tname = request.form("tname")
ccemail = request.form("ccemail")
bccemail = request.form("bccemail")
subj = request.form("subj")
msg = request.form("msg")
if (len(temail)<2)or(len(femail)<2) _
  or(len(subj)<2) then
  response.write("Please enter your name and/or e-mail address")
else
  Set Mail = Server.CreateObject("Persits.MailSender") 
  Mail.Host = gethost 
  Mail.From = femail 
  Mail.FromName = fname
  Mail.AddAddress temail ,tname  
  if len(remail) > 2 then Mail.AddReplyTo remail end if
  if len(ccemail) > 2 then Mail.AddCC ccemail end if  
  if len(bccemail) > 2 then Mail.AddBCC bccemail end if  
  Mail.Subject = subj
  Mail.Body = msg
  On Error Resume Next 
  Mail.Send 
  if Err <> 0 then 
    ErrMsg = "เกิดข้อผิดพลาด : " & Err.Description 
  else
    ErrMsg = "ส่ง mail เรียบร้อย<br>"
    ErrMsg = ErrMsg + "ถ้ามีโอกาส กลับมาใช้บริการใหม่นะครับ"
  end If
  set mail = nothing
  response.write(ErrMsg)
end if
%>
</body>