Class SendMailFactory

  • All Implemented Interfaces:
    javax.naming.spi.ObjectFactory

    public class SendMailFactory
    extends java.lang.Object
    implements javax.naming.spi.ObjectFactory
    Factory class that creates a JNDI named javamail MimePartDataSource object which can be used for sending email using SMTP.

    Can be configured in the Context scope of your server.xml configuration file.

    Example:

     <Resource name="mail/send"
               auth="CONTAINER"
               type="jakarta.mail.internet.MimePartDataSource"
               factory="org.apache.naming.factory.SendMailFactory"
               mail.smtp.host="your.smtp.host"
               mail.smtp.user="someuser"
               mail.from="someuser@some.host"
               mail.smtp.sendpartial="true"
               mail.smtp.dsn.notify="FAILURE"
               mail.smtp.dsn.ret="FULL"
               />
     
    Author:
    Glenn Nielsen Rich Catlett
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected static java.lang.String DataSourceClassName  
    • Constructor Summary

      Constructors 
      Constructor Description
      SendMailFactory()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.Object getObjectInstance​(java.lang.Object refObj, javax.naming.Name name, javax.naming.Context ctx, java.util.Hashtable<?,​?> env)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • DataSourceClassName

        protected static final java.lang.String DataSourceClassName
        See Also:
        Constant Field Values
    • Constructor Detail

      • SendMailFactory

        public SendMailFactory()
    • Method Detail

      • getObjectInstance

        public java.lang.Object getObjectInstance​(java.lang.Object refObj,
                                                  javax.naming.Name name,
                                                  javax.naming.Context ctx,
                                                  java.util.Hashtable<?,​?> env)
                                           throws java.lang.Exception
        Specified by:
        getObjectInstance in interface javax.naming.spi.ObjectFactory
        Throws:
        java.lang.Exception