Jmail Object

Oct 05 at 9:20am - admin
Answer:
 
Page one - MailForm.asp
This sample shows how you can add all the elements in a form to your email.
 
<html>
<head>
<title>emailform</title>
</head>
<body>
<form method="post" action="SendMail.asp">
Name <INPUT name="name" type="text"><br>
Email<INPUT name="Email" type="text"><br>
Company<INPUT name="company" type="text"><br>
Occupation <SELECT name="state">
<OPTION value="coder">Coder
<OPTION value="coder">Hacker
<OPTION value="coder">Developer
<OPTION value="coder">Guru
</SELECT><BR>
Favorite TV-show<TEXTAREA name="tv-show"></TEXTAREA>
<br>
<INPUT type="submit" value= "Send">

</form>
</body>
</html>
 
 
Page two - SendMail.asp
 
<html>
<head>
<title>Confirmation</title>
</head>
<body>
<%
Set JMail = Server.CreateObject("JMail.SMTPMail")
' This is my local SMTP server
JMail.ServerAddress = "mail.dimac.net"
' This is me....
JMail.Sender = "
mrsmith@acme.com "
JMail.Subject = "Here you go..."
' Get the recipients mailbox from a form (note the lack of a equal sign).
JMail.AddRecipient "
drdoo@perky.com "
JMail.Priority = 1
JMail.body = "The form was filled out with the following values:" & vbcrlf
Dim el
'add every form element and its value to the email
FOR EACH el IN Request.Form
JMail.appendtext( el & ": " & Request.form(el) & vbcrlf )
NEXT
' Send it...
JMail.Execute
%>
<center>
An e-mail has been sent to your mailbox (<%=request.form("email")%>).
</center>
</body>
</html>