<%@CodePage=65001 Language=VBScript %> <% Option Explicit%>
<%
Session.CodePage = 65001
Response.CodePage= 65001
Response.CharSet = "utf-8"
%>
<html dir="rtl">
<head>
<%Dim mes,sTo,sFrom,ssubject,sMailServer,sBody,IsSuccess
mes = ""
IsSuccess = false
sTo = Trim(Request.Form("txtTo"))
sFrom = Trim(Request.Form("txtFrom"))
ssubject = Trim(Request.Form("txtsubject"))
sMailServer = "127.0.0.1"
sBody = Trim(Request.Form("txtBody"))
if Request("__action")="TestEMail" then
TestEMail()
end if
Sub TestEMail()
Dim objMail,objConf,objFields
Set objMail = Server.CreateObject("CDO.Message")
Set objConf = Server.CreateObject("CDO.Configuration")
Set objFields = objConf.Fields
With objFields
.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = sMailServer
.Item("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 10
.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
.Update
End With
With objMail
Set .Configuration = objConf
.From = sFrom
.To = sTo
.Subject = ssubject
.TextBody = sBody
End With
Err.Clear
on error resume next
objMail.Send
if len(Err.Description) = 0 then
mes = " Send To" + sTo
IsSuccess = true
else
mes = "Not Sent!<br>" + Err.Description
end if
Set objFields = Nothing
Set objConf = Nothing
Set objMail = Nothing
End sub
Sub Alert(html)
if IsSuccess then
Response.Write "<div class='testRelults' ><span style='color: #008000' >Sent OK: </span>" & html & "</div>"
else
Response.Write "<div class='testRelults' ><span style='color: #F00000' >Error: </span>" & html & "</div>"
end if
End Sub
%>
<link rel="stylesheet" type="text/css" href="css/target.css">
<title>Mail Sender</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta http-equiv="Content-Language" content="fa">
</head>
<body topmargin="50" leftmargin="51" rightmargin="50" bottommargin="50" marginwidth="3" marginheight="2">
<table border="0" style="border-collapse: collapse" width="100%" id="table1" cellspacing="5" cellpadding="5">
<tr>
<td>
<form id="form1" action="mail.asp?__action=TestEMail&tp=<%= rnd(1)*100*timer %>" method="POST">
<% if len(mes) > 0 then Alert(mes) end if %><fieldset>
<legend id="LegendName"> <span class="smText">ایمیل </span> </legend>
<p></p>
<table class="formFields" cellspacing="0" width="100%" dir="rtl">
<tr>
<td class="name"><label for="txtSubject"><span class="smtext">موضوع</span><span lang="fa" class="smtext">:</span></label></td>
<td dir="ltr" align="right">
<input name="txtsubject" size="25" value="<% Response.Write(ssubject) %>">
</td>
</tr>
<tr>
<td class="name"><label for="txtFrom">
<span lang="fa" class="smtext">آدرس فرستنده:</span></label></td>
<td dir="ltr" align="right">
<input name="txtFrom" size="25" value="<% Response.Write(sFrom)%>">
</td>
</tr>
<tr>
<td class="name"><label for="txtFrom">
<span lang="fa" class="smtext">آدرس گیرنده:
</span></label></td>
<td dir="ltr" align="right">
<input name="txtTo" size="25" value="<% Response.Write(sTo) %>" maxlength="50">
</td>
</tr>
<tr>
<td class="name"><label for="txtBody">
<span lang="fa" class="smtext">متن نامه:</span></label></td>
<td rowspan="2" dir="ltr" align="right">
<textarea name="txtBody" cols="47" rows="6" readonly="true"></textarea> </td>
</tr>
<tr>
<td></td>
<td></td>
</tr>
</table>
<p></p></fieldset>
<p align="center"><button type="submit" name="bname_ok">ارسال
</button></p>
</form>
</td>
</tr>
</table>
</body>
</html>