mina_shariat
Member
حذف
آخرین ویرایش:
<form method="post" name="frmEnquiry" action="send_email.asp">
<table width="450" border="0" align="center" cellpadding="0" cellspacing="0" >
<!-- First tabe row -->
<tr>
<td colspan="3"> <font size="2"><b>*فیلدهایی که حتما باید پر شوند </b></font><br>
</tr>
<!-- second table row -->
<tr>
<td width="265">نام* <br>
<input maxlength="30" name="VisitorsName">
</td>
<!-- Coloum two in the second table row -->
<td width="185" colspan="2">آدرس ایمیل خودتان* <br>
<input maxlength="30" name="VisitorsEmail">
</td>
</tr>
<!-- Third table row spread over 3 coloumns -->
<tr>
<td width="265">نام گیرنده* <br>
<input maxlength="30" name="FriendsName">
</td>
<td width="185" colspan="2">آدرس ایمیل گیرنده* <br>
<input maxlength="30" name="FriendsEmail">
</td>
</tr>
<tr>
<td colspan="3">موضوع نامه* <br>
<input maxlength="50" name="Subject">
</td>
</tr>
<td colspan="3">متن نامه* <br>
<textarea name="message" cols="50" rows="10"></textarea>
</td>
</tr>
<tr align="center">
<td colspan="3">
<input type="submit" name="Submit" value="ارسال ایمیل" class="button">
<input type="reset" name="Reset" value="فرم خالی" class="button">
</td>
</tr>
</table>
</form>
<%
'Set the response buffer to true so we execute all asp code before sending the HTML to the clients browser
Response.Buffer = True
'Dimension variables
Dim strBody 'Holds the body of the e-mail
Dim objJMail 'Holds the mail server object
Dim strMessage 'Holds the users message
Dim strSMTPServerAddress 'Holds the SMTP Server address
Dim blnMailSent 'Set to true if the email has been correctly sent
'---------- Place the address of the SMTP server you are using in the following sting ---------------
strSMTPServerAddress = "192.108.102.204"
'-----------------------------------------------------------------------------------------------------
'Read in the message of the e-mail
strMessage = Request.Form("Message")
'Replace line returns with HTML line returns
strMessage = Replace(strMessage, vbCrLf, "<br>")
'Initialse strBody string with the body of the e-mail
strBody = "Hi " & Request.Form("FriendsName")
strBody = strBody & "<br><br>" & strMessage
strBody = strBody & "<br><br>From " & Request.Form("VisitorsName") & " - " & Request.Form("VisitorsEmail")
'Send the e-mail
'Create the e-mail server object
Set objJMail = Server.CreateObject("JMail.SMTPMail")
'Set the Jamil component to run in silent mode
objJMail.Silent = True
'Out going SMTP mail server address
objJMail.ServerAddress = strSMTPServerAddress
'Senders email address
objJMail.Sender = Request.Form("VisitorsEmail")
'Senders name
objJMail.SenderName = Request.Form("VisitorsName")
'Who the e-mail is sent to
objJMail.AddRecipient Request.Form("FriendsEmail")
'Set the subject of the e-mail
objJMail.Subject = Request.Form("Subject")
'Set the main body of the e-mail (HTML format)
objJMail.HTMLBody = strBody
'Set the main body of the e-mail (Plain Text format)
'objJMail.Body = strBody
'Importance of the e-mail ( 1 - highest priority, 3 - normal, 5 - lowest)
objJMail.Priority = 3
'Send the e-mail (blnMailSent is set to true if the email is sent successfully)
blnMailSent = objJMail.Execute
'Close the server object
Set objJMail = Nothing
%>
<%
'If all has run well display an message saying the email has been sent
If blnMailSent = True Then
%>
Thank-you <% = Request.Form("VisitorsName") %>
<br>
Your e-mail has been sent to <% = Request.Form("FriendsName") %>
<%
'Else if the email has not been sent successfully display an error message
Else
%>
Sorry <% = Request.Form("VisitorsName") %> an error has occured
<br>
Your e-mail has not been sent to <% = Request.Form("FriendsName") %>
<br><br>
There may have been a problem with one of the email addresses used
<%
End If
%>
<tr>
<td width="265">نام گیرنده* <br>
<input maxlength="30" name="FriendsName"> </td>
<td width="185" colspan="2">آدرس ایمیل گیرنده* <br>
<input maxlength="30" name="FriendsEmail"> </td>
</tr>
strBody = "Hi " & Request.Form("FriendsName")
Request.Form("FriendsName")
"Hossein"
objJMail.AddRecipient= Request.Form("FriendsEmail")
Request.Form("FriendsEmail")