Java Doc for JavaMailSenderImpl.java in  » J2EE » spring-framework-2.0.6 » org » springframework » mail » javamail » 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 » J2EE » spring framework 2.0.6 » org.springframework.mail.javamail 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   org.springframework.mail.javamail.JavaMailSenderImpl

JavaMailSenderImpl
public class JavaMailSenderImpl implements JavaMailSender(Code)
Production implementation of the JavaMailSender interface, supporting both JavaMail MimeMessage MimeMessages and Spring SimpleMailMessage SimpleMailMessages . Can also be used as a plain org.springframework.mail.MailSender implementation.

Allows for defining all settings locally as bean properties. Alternatively, a pre-configured JavaMail javax.mail.Session can be specified, possibly pulled from an application server's JNDI environment.

Non-default properties in this object will always override the settings in the JavaMail Session. Note that if overriding all values locally, there is no added value in setting a pre-configured Session.
author:
   Dmitriy Kopylenko
author:
   Juergen Hoeller
since:
   10.09.2003
See Also:   javax.mail.internet.MimeMessage
See Also:   javax.mail.Session
See Also:   JavaMailSenderImpl.setSession
See Also:   JavaMailSenderImpl.setJavaMailProperties
See Also:   JavaMailSenderImpl.setHost
See Also:   JavaMailSenderImpl.setPort
See Also:   JavaMailSenderImpl.setUsername
See Also:   JavaMailSenderImpl.setPassword



Field Summary
final public static  intDEFAULT_PORT
     The default port: -1.
final public static  StringDEFAULT_PROTOCOL
     The default protocol: 'smtp'.
final protected  Loglogger
    

Constructor Summary
public  JavaMailSenderImpl()
     Create a new instance of the JavaMailSenderImpl class.

Method Summary
public  MimeMessagecreateMimeMessage()
     This implementation creates a SmartMimeMessage, holding the specified default encoding and default FileTypeMap.
public  MimeMessagecreateMimeMessage(InputStream contentStream)
    
protected  voiddoSend(MimeMessage[] mimeMessages, Object[] originalMessages)
     Actually send the given array of MimeMessages via JavaMail.
public  StringgetDefaultEncoding()
     Return the default encoding for MimeMessage MimeMessages , or null if none.
public  FileTypeMapgetDefaultFileTypeMap()
     Return the default Java Activation FileTypeMap for MimeMessage MimeMessages , or null if none.
public  StringgetHost()
     Return the mail server host.
public  StringgetPassword()
     Return the password for the account at the mail host.
public  intgetPort()
     Return the mail server port.
public  StringgetProtocol()
     Return the mail protocol.
public  SessiongetSession()
     Return the JavaMail Session.
protected  TransportgetTransport(Session session)
     Obtain a Transport object from the given JavaMail Session, using the configured protocol.

Can be overridden in subclasses, e.g.

public  StringgetUsername()
     Return the username for the account at the mail host.
public  voidsend(SimpleMailMessage simpleMessage)
    
public  voidsend(SimpleMailMessage[] simpleMessages)
    
public  voidsend(MimeMessage mimeMessage)
    
public  voidsend(MimeMessage[] mimeMessages)
    
public  voidsend(MimeMessagePreparator mimeMessagePreparator)
    
public  voidsend(MimeMessagePreparator[] mimeMessagePreparators)
    
public  voidsetDefaultEncoding(String defaultEncoding)
     Set the default encoding to use for MimeMessage MimeMessages created by this instance.
public  voidsetDefaultFileTypeMap(FileTypeMap defaultFileTypeMap)
     Set the default Java Activation FileTypeMap to use for MimeMessage MimeMessages created by this instance.

A FileTypeMap specified here will be autodetected by MimeMessageHelper , avoiding the need to specify the FileTypeMap for each MimeMessageHelper instance.

For example, you can specify a custom instance of Spring's ConfigurableMimeFileTypeMap here.

public  voidsetHost(String host)
     Set the mail server host, typically an SMTP host.
public  voidsetJavaMailProperties(Properties javaMailProperties)
     Set JavaMail properties for the Session.
public  voidsetPassword(String password)
     Set the password for the account at the mail host, if any.

Note that the underlying JavaMail Session has to be configured with the property "mail.smtp.auth" set to true, else the specified password will not be sent to the mail server by the JavaMail runtime.

public  voidsetPort(int port)
     Set the mail server port.
public  voidsetProtocol(String protocol)
     Set the mail protocol.
public  voidsetSession(Session session)
     Set the JavaMail Session, possibly pulled from JNDI.
public  voidsetUsername(String username)
     Set the username for the account at the mail host, if any.

Note that the underlying JavaMail Session has to be configured with the property "mail.smtp.auth" set to true, else the specified username will not be sent to the mail server by the JavaMail runtime.


Field Detail
DEFAULT_PORT
final public static int DEFAULT_PORT(Code)
The default port: -1.



DEFAULT_PROTOCOL
final public static String DEFAULT_PROTOCOL(Code)
The default protocol: 'smtp'.



logger
final protected Log logger(Code)
Logger available to subclasses




Constructor Detail
JavaMailSenderImpl
public JavaMailSenderImpl()(Code)
Create a new instance of the JavaMailSenderImpl class.

Initializes the JavaMailSenderImpl.setDefaultFileTypeMap "defaultFileTypeMap" property with a default ConfigurableMimeFileTypeMap .





Method Detail
createMimeMessage
public MimeMessage createMimeMessage()(Code)
This implementation creates a SmartMimeMessage, holding the specified default encoding and default FileTypeMap. This special defaults-carrying message will be autodetected by MimeMessageHelper , which will use the carried encoding and FileTypeMap unless explicitly overridden.
See Also:   JavaMailSenderImpl.setDefaultEncoding
See Also:   JavaMailSenderImpl.setDefaultFileTypeMap



createMimeMessage
public MimeMessage createMimeMessage(InputStream contentStream) throws MailException(Code)



doSend
protected void doSend(MimeMessage[] mimeMessages, Object[] originalMessages) throws MailException(Code)
Actually send the given array of MimeMessages via JavaMail.
Parameters:
  mimeMessages - MimeMessage objects to send
Parameters:
  originalMessages - corresponding original message objectsthat the MimeMessages have been created from (with same arraylength and indices as the "mimeMessages" array), if any
throws:
  org.springframework.mail.MailAuthenticationException - in case of authentication failure
throws:
  org.springframework.mail.MailSendException - in case of failure when sending a message



getDefaultEncoding
public String getDefaultEncoding()(Code)
Return the default encoding for MimeMessage MimeMessages , or null if none.



getDefaultFileTypeMap
public FileTypeMap getDefaultFileTypeMap()(Code)
Return the default Java Activation FileTypeMap for MimeMessage MimeMessages , or null if none.



getHost
public String getHost()(Code)
Return the mail server host.



getPassword
public String getPassword()(Code)
Return the password for the account at the mail host.



getPort
public int getPort()(Code)
Return the mail server port.



getProtocol
public String getProtocol()(Code)
Return the mail protocol.



getSession
public Session getSession()(Code)
Return the JavaMail Session.



getTransport
protected Transport getTransport(Session session) throws NoSuchProviderException(Code)
Obtain a Transport object from the given JavaMail Session, using the configured protocol.

Can be overridden in subclasses, e.g. to return a mock Transport object.
See Also:   javax.mail.Session.getTransport(String)
See Also:   JavaMailSenderImpl.getProtocol()




getUsername
public String getUsername()(Code)
Return the username for the account at the mail host.



send
public void send(SimpleMailMessage simpleMessage) throws MailException(Code)



send
public void send(SimpleMailMessage[] simpleMessages) throws MailException(Code)



send
public void send(MimeMessage mimeMessage) throws MailException(Code)



send
public void send(MimeMessage[] mimeMessages) throws MailException(Code)



send
public void send(MimeMessagePreparator mimeMessagePreparator) throws MailException(Code)



send
public void send(MimeMessagePreparator[] mimeMessagePreparators) throws MailException(Code)



setDefaultEncoding
public void setDefaultEncoding(String defaultEncoding)(Code)
Set the default encoding to use for MimeMessage MimeMessages created by this instance.

Such an encoding will be auto-detected by MimeMessageHelper .




setDefaultFileTypeMap
public void setDefaultFileTypeMap(FileTypeMap defaultFileTypeMap)(Code)
Set the default Java Activation FileTypeMap to use for MimeMessage MimeMessages created by this instance.

A FileTypeMap specified here will be autodetected by MimeMessageHelper , avoiding the need to specify the FileTypeMap for each MimeMessageHelper instance.

For example, you can specify a custom instance of Spring's ConfigurableMimeFileTypeMap here. If not explicitly specified, a default ConfigurableMimeFileTypeMap will be used, containing an extended set of MIME type mappings (as defined by the mime.types file contained in the Spring jar).
See Also:   MimeMessageHelper.setFileTypeMap




setHost
public void setHost(String host)(Code)
Set the mail server host, typically an SMTP host.

Default is the default host of the underlying JavaMail Session.




setJavaMailProperties
public void setJavaMailProperties(Properties javaMailProperties)(Code)
Set JavaMail properties for the Session.

A new Session will be created with those properties. Use either this method or JavaMailSenderImpl.setSession , but not both.

Non-default properties in this instance will override given JavaMail properties.




setPassword
public void setPassword(String password)(Code)
Set the password for the account at the mail host, if any.

Note that the underlying JavaMail Session has to be configured with the property "mail.smtp.auth" set to true, else the specified password will not be sent to the mail server by the JavaMail runtime. If you are not explicitly passing in a Session to use, simply specify this setting via JavaMailSenderImpl.setJavaMailProperties .
See Also:   JavaMailSenderImpl.setSession
See Also:   JavaMailSenderImpl.setUsername




setPort
public void setPort(int port)(Code)
Set the mail server port.

Default is JavaMailSenderImpl.DEFAULT_PORT , letting JavaMail use the default SMTP port (25).




setProtocol
public void setProtocol(String protocol)(Code)
Set the mail protocol. Default is "smtp".



setSession
public void setSession(Session session)(Code)
Set the JavaMail Session, possibly pulled from JNDI.

Default is a new Session without defaults, that is completely configured via this instance's properties.

If using a pre-configured Session, non-default properties in this instance will override the settings in the Session.
See Also:   JavaMailSenderImpl.setJavaMailProperties




setUsername
public void setUsername(String username)(Code)
Set the username for the account at the mail host, if any.

Note that the underlying JavaMail Session has to be configured with the property "mail.smtp.auth" set to true, else the specified username will not be sent to the mail server by the JavaMail runtime. If you are not explicitly passing in a Session to use, simply specify this setting via JavaMailSenderImpl.setJavaMailProperties .
See Also:   JavaMailSenderImpl.setSession
See Also:   JavaMailSenderImpl.setPassword




Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

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