The first thing you need to do is create a formpage.asp page with the code below:
Next, we create a confirmation.asp page and enter the code as seen below:
<% DIM strEmail, strFirstName, strLastName, strSubject, strComments, Mailer strEmail = Request.Form("Email") strFirstName = Request.Form("FirstName") strLastName = Request.Form("LastName") strSubject = Request.Form("Subject") strComments = Request.Form("Comments") Set JMail = Server.CreateObject("JMail.SMTPMail") JMail.ServerAddress = "mail.aspwebpro.com" JMail.AddRecipient "general@aspwebpro.com" JMail.Sender = strEmail JMail.Subject = strSubject JMail.Body = strComments JMail.Execute Set JMail= Nothing IF NOT JMail.Execute THEN Response.Write( "ERROR MESSAGE: " & JMail.ErrorMessage & "
" & vbcrlf )
Response.Write( "ERROR SOURCE: " & JMail.ErrorSource & "
" & vbcrlf )
Response.Write( "LOG:
" & JMail.Log & "" & vbcrlf )
ELSE
Response.Write "
Your :" & strSubject & " Newsletter has been successfully sent to " & intSubscribers & " subscribers."
END IF
%>
Now you have a complete form that sends data to an email address and displays a customized message for your user. The default for JMail is to send text messages if you want to send HTML messages you can simply include this extra line of code before the JMail.Body line.
JMail.ContentType = "text/html"
Enjoy!
http://www.aspwebpro.com/aspscripts/email/jmail.asp
No comments:
Post a Comment