Java Doc for MailSender.java in  » Portal » DLOG4J » dlog4j » util » mail » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Portal » DLOG4J » dlog4j.util.mail 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


dlog4j.util.mail.MailSender

MailSender
abstract public class MailSender extends Authenticator (Code)
邮件发送组件,具体的使用方法参照该类的main方法
author:
   Liudong


Field Summary
protected  MimeMessagemailMessage
    
protected  SessionmailSession
    
protected  InternetAddressmailToAddress
    
protected  BodyPartmessageBodyPart
    
protected  Multipartmultipart
    

Constructor Summary
protected  MailSender(String smtpHost, String username, String password)
    
protected  MailSender(String smtpHost, int smtpPort, String username, String password)
    

Method Summary
public static  MailSendergetHtmlMailSender(String smtpHost, String username, String password)
    
public static  MailSendergetHtmlMailSender(String smtpHost, int smtpPort, String username, String password)
    
protected  PasswordAuthenticationgetPasswordAuthentication()
    
public static  MailSendergetTextMailSender(String smtpHost, String username, String password)
    
public static  MailSendergetTextMailSender(String smtpHost, int smtpPort, String username, String password)
    
public static  voidmain(String args)
    
public  voidsendMail()
    
public  voidsetAttachments(String attachmentName)
    
abstract public  voidsetMailContent(String mailContent)
    
public  voidsetMailFrom(String mailFrom, String sender)
    
public  voidsetMailTo(String[] mailTo, String mailType)
    
public  voidsetSendDate(Date sendDate)
    
public  voidsetSubject(String mailSubject)
    

Field Detail
mailMessage
protected MimeMessage mailMessage(Code)



mailSession
protected Session mailSession(Code)



mailToAddress
protected InternetAddress mailToAddress(Code)



messageBodyPart
protected BodyPart messageBodyPart(Code)



multipart
protected Multipart multipart(Code)




Constructor Detail
MailSender
protected MailSender(String smtpHost, String username, String password)(Code)
构造函数
Parameters:
  smtpHost -
Parameters:
  username -
Parameters:
  password -



MailSender
protected MailSender(String smtpHost, int smtpPort, String username, String password)(Code)
构造函数
Parameters:
  smtpHost -
Parameters:
  smtpPort -
Parameters:
  username -
Parameters:
  password -




Method Detail
getHtmlMailSender
public static MailSender getHtmlMailSender(String smtpHost, String username, String password)(Code)
构造一个超文本邮件发送实例
See Also:    getHtmlMailSender(String smtpHost, int smtpPort, String username, String password)
Parameters:
  smtpHost -
Parameters:
  username -
Parameters:
  password -



getHtmlMailSender
public static MailSender getHtmlMailSender(String smtpHost, int smtpPort, String username, String password)(Code)
构造一个超文本邮件发送实例
Parameters:
  smtpHost - SMTP服务器地址
Parameters:
  smtpPort - SMTP服务器端口
Parameters:
  username - SMTP邮件发送帐号
Parameters:
  password - SMTP邮件发送帐号对应的密码



getPasswordAuthentication
protected PasswordAuthentication getPasswordAuthentication()(Code)
用于实现邮件发送用户验证
See Also:   javax.mail.Authenticator.getPasswordAuthentication



getTextMailSender
public static MailSender getTextMailSender(String smtpHost, String username, String password)(Code)
构造一个纯文本邮件发送实例
See Also:    getTextMailSender(String smtpHost, int smtpPort, String username, String password)
Parameters:
  smtpHost -
Parameters:
  username -
Parameters:
  password -



getTextMailSender
public static MailSender getTextMailSender(String smtpHost, int smtpPort, String username, String password)(Code)
构造一个纯文本邮件发送实例
Parameters:
  smtpHost - SMTP服务器地址
Parameters:
  smtpPort - SMTP服务器端口
Parameters:
  username - SMTP邮件发送帐号
Parameters:
  password - SMTP邮件发送帐号对应的密码



main
public static void main(String args)(Code)
邮件发送测试
Parameters:
  args -



sendMail
public void sendMail() throws MessagingException, SendFailedException(Code)
开始发送邮件
throws:
  MessagingException -
throws:
  SendFailedException -



setAttachments
public void setAttachments(String attachmentName) throws MessagingException(Code)
设置邮件发送附件
Parameters:
  attachmentName -
throws:
  MessagingException -



setMailContent
abstract public void setMailContent(String mailContent) throws MessagingException(Code)
所有子类都需要实现的抽象方法,为了支持不同的邮件类型
Parameters:
  mailContent -
throws:
  MessagingException -



setMailFrom
public void setMailFrom(String mailFrom, String sender) throws UnsupportedEncodingException, MessagingException(Code)
设置发件人地址
Parameters:
  mailFrom -
throws:
  MessagingException -
throws:
  UnsupportedEncodingException -



setMailTo
public void setMailTo(String[] mailTo, String mailType) throws Exception(Code)
设置收件人地址,收件人类型为to,cc,bcc(大小写不限)
Parameters:
  mailTo - 邮件接收者地址
Parameters:
  mailType - 值为to,cc,bcc
author:
   Liudong



setSendDate
public void setSendDate(Date sendDate) throws MessagingException(Code)
设置邮件发送日期
Parameters:
  sendDate -
throws:
  MessagingException -



setSubject
public void setSubject(String mailSubject) throws MessagingException(Code)
设置邮件标题
Parameters:
  mailSubject -
throws:
  MessagingException -



www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.