<%
'First, initialize the JMail program...
Set JMail = Server.CreateObject("JMail.Message")
'Next, define your SMTP server & port address...
'(note that you just need to use the following line
JMail.ISOEncodeHeaders = False
JMail.From = "
[email protected]"
JMail.FromName = "Test Message"
'The Subject property allows you to fill in the subject of the
'e-mail message you're sending...
JMail.Subject = "This is a Test of JMail"
'To add recipients to the e-mail message, you use the AddRecipient
'method. Note that it does not require the use of an = sign!
JMail.AddRecipient Request.Form("Email")
'You can keep adding recipients until you're done...
'JMail.AddRecipient "
[email protected]"
'JMail.AddRecipient "
[email protected]"
' Get the recipients mailbox from a form (note the lack of an equal sign).
'JMail.AddRecipient Request.Form("Email")
'You can also add recipients to what would normally be the CC:
'and BCC: fields of your e-mail, as follows (respectively)...
'JMail.AddRecipientCC "
[email protected]"
'JMail.AddRecipientBCC "
[email protected]"
'If you want to make the To: address more personal, you can
'use the AddRecipientEx method to add not only the person's
'e-mail address, but their name, too...
'JMail.AddRecipientEx "
[email protected]", "Sparky O'Malley"
'The body of your message can be set in a number of ways. To
'set the body explicitly, you can just do something like this...
JMail.Body = "This is a test Email from a J-Mail Script."
'Or you might need to add text later after a generic greeting,
'in which case you'd append text to the body like this...
JMail.Body = JMail.Body & " Have a nice day!"
'You can also append text with the AppendText method...again,
'note the lack of an = sign here because you're using a method,
'not setting a property
'JMail.AppendText "Have a nice day!"
'If you have some text stored in a file, you can also use the
'contents of that file to set the body of the message, as
'follows...
'JMail.AppendBodyFromFile "c:\webserver\yourdomain\htdocs\mytext.txt"
'If your message is really important, you may want to set the
'message priority with the Priority property. When setting this
'property, remember that 1 is highest priority (urgent) and
'5 is lowest priority...
JMail.Priority = 1
'You can even add attachments to your message. As with the
'AddRecipient method, this does not use = signs and can be called
'as many times as you have attachments...
'JMail.AddAttachment "c:\webserver\yourdomain\htdocs\pix\myphoto.jp g"
'JMail.AddAttachment "c:\webserver\yourdomain\htdocs\faq\faq1.txt"
'Once you've set everything up, it's just a matter of sending the
'message...
JMail.Send(Request.Form("SMTP"))
%>