SendMailFactory (Apache Tomcat 10.1.20 API Documentation)
Description: declaration: package: org.apache.naming.factory, class: SendMailFactory

Package org.apache.naming.factory

# Class SendMailFactory

java.lang.Object
org.apache.naming.factory.SendMailFactory

All Implemented Interfaces:
  `ObjectFactory`

public class SendMailFactory extends Object implements 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"/>
     <ResourceParams name="mail/send">
       <parameter><name>factory</name>
         <value>org.apache.naming.factory.SendMailFactory</value>
       </parameter>
       <parameter><name>mail.smtp.host</name>
         <value>your.smtp.host</value>
       </parameter>
       <parameter><name>mail.smtp.user</name>
         <value>someuser</value>
       </parameter>
       <parameter><name>mail.from</name>
         <value>someuser@some.host</value>
       </parameter>
       <parameter><name>mail.smtp.sendpartial</name>
         <value>true</value>
       </parameter>
      <parameter><name>mail.smtp.dsn.notify</name>
         <value>FAILURE</value>
       </parameter>
       <parameter><name>mail.smtp.dsn.ret</name>
         <value>FULL</value>
       </parameter>
     </ResourceParams>

Author:
  Glenn Nielsen Rich Catlett

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `protected static final String`
  `DataSourceClassName`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `SendMailFactory()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `Object`
  `getObjectInstance(Object refObj, Name name, Context ctx, Hashtable<?,?> env)`

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Field Details

  - ### DataSourceClassName

    protected static final String DataSourceClassName
    See Also:
      - Constant Field Values

- ## Constructor Details

  - ### SendMailFactory

    public SendMailFactory()

- ## Method Details

  - ### getObjectInstance

    public Object getObjectInstance(Object refObj, Name name, Context ctx, Hashtable<?,?> env) throws Exception
    Specified by:
      `getObjectInstance` in interface `ObjectFactory`
    Throws:
      `Exception`