Form to mail: JMail SMTP(Mail with attachment in JAVA)

<%

'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 = "sample@securedata.net"
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 "joe@blow.com"
'JMail.AddRecipient "shag@austinbaby.com"
' 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 "boss@job.com"
'JMail.AddRecipientBCC "secret@squirrel.com"
'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 "lame@address.com", "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.jpg"
'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"))

%>










   



MSN Nick Name



More Resources...





Most Viewed Services:
  1. HTML Tutorial
  2. XHTML Tutorial
  3. CSS Tutorial
  4. Javascript Tutorial
  5. DHTML Tutorial
  6. VB Script
  7. TCP/IP Tutorial
  8. ADO Tutorial
  9. MYSQL Tutorial
  10. ASP Tutorial
  11. AJAX Tutorial
  12. CFML Tutorial
  13. PHP Tutorial
  14. WML Tutorial
  15. FLASH Tutorial
  16. XML Tutorial
  17. RSS Tutorial
  18. SQL Tutorial
  19. HTML Articles
  1. Javascript Articles
  2. PHP Articles
  3. SEO Articles
  4. Web Design Articles
  5. SEO Tips
  6. Web Design Tips
  7. Articles
  8. CSS
  9. CSS Tips
  10. HTML Tips
  11. JAVASCRIPT Tips
  12. MYSQL Tips
  13. PHP Tips
  14. Money
  15. Tutorials
  16. Web Hosting



  • Home
  • Web Directory
  • Top Directoriers
  • Webmaster Directories
  • Contact
  • © Copyright 2006-2010 All Rights Reserved By CodeDcode.Com : HTML : RSS : TEXT : XML