EMAIL

From Commander4j

EMAIL Map Configuration

config.xml

    <map id="map02" enabled="Y" description="Email Send PDF">
        <input id="in1" description="Read File">
            <type>EMAIL</type>
            <mask>pdf</mask>
            <path>./interface/input/421 (GEN Email Send)</path>
            <pollingInterval>2000</pollingInterval>
        </input>
        <output id="out1" enabled="Y" description="Send Email">
            <path>./interface/output/421 (GEN Email Send)</path>
            <type>EMAIL</type>
            <subject>Test email of PDF document</subject>
            <message>PDF Attached.</message>
            <emailListID>PDF</emailListID>
        </output>
    </map>

The email connector provides an automated method of sending files via email. It's currently a "send only" connector so it does not have the ability to check for incomming emails.

If we look at the example configuration above we can see that both the input and output types are defined as

 <type>EMAIL</type>

The way the system works is that you specify a folder and file type (mask) that you want to detect on the input connector side and the destination / subject / message on the output side.

Rather than putting email addresses in the middleware config directly the output map lets you specify a distribution list

 <emailListID>PDF</emailListID>

The email addressed associated with the emailListID are held in the email.xml configuration file. See Email Configuration for additional information on this file.

EMAIL Settings

email.xml

 <?xml version="1.0" encoding="UTF-8"?>
 <emailSettings>
    <configuration>
        <property name="mail.smtp.auth" value="true"/>
        <property name="mail.smtp.starttls.enable" value="true"/>
        <property name="mail.smtp.host" value="smtp.gmail.com"/>
        <property name="mail.smtp.socketFactory.port" value="465"/>
        <property name="mail.smtp.user" value="dummy@gmail.com"/>
        <property name="mail.smtp.password" value="mycomplexpassword"/>
        <property name="mail.smtp.socketFactory.class" value="javax.net.ssl.SSLSocketFactory"/>
        <property name="mail.smtp.auth" value="true"/>
        <property name="mail.smtp.port" value="465"/>
        <property name="mail.smtp.from" value="dummy@gmail.com"/>
    </configuration>
    <distributionList id="Monitor" enabled="Y" maxFrequencyMins="0">
        <toAddressList>dummy@gmail.com</toAddressList>
    </distributionList>
    <distributionList id="Error" enabled="Y" maxFrequencyMins="5">
        <toAddressList>dummy@gmail.com</toAddressList>
    </distributionList>
    <distributionList id="Excel" enabled="Y" maxFrequencyMins="5">
        <toAddressList>dummy@gmail.com</toAddressList>
    </distributionList>
    <distributionList id="PDF" enabled="Y" maxFrequencyMins="5">
        <toAddressList>dummy@gmail.com</toAddressList>
    </distributionList>
 </emailSettings>

You will see there are several distributionList entries above and you can create new ones if you want. Each section has the following attributes.

Some of these lists have a "standard" purpose and should not be deleted or renamed.

Monitor is used to send daily statistics on the number of messages processed. It will also email you to say if the Middleware service stops or starts.

Error - as it's name suggests will inform you of any errors encountered, such as a network share becoming unavailable.

Distribution List Settings

System Keys
Element Value Description
id id A identification which can be used in a mapping file. The email.xml can have multiple distribution lists but each one must have a unique id.
description string Meaningful description of what the distribution list is for.
enabled Y or N A simple way to disable or enable a list.
maxFrequencyMins nnn Number of minutes between identical emails. This can prevent or limit the number of emails which can be sent due to a persistent error condition.
toAddressList email Email addresses separated with a comma

Example Email Settings

SMTP No Authentication Example

    <configuration>
        <property name="mail.smtp.starttls.enable" value="false"/>
        <property name="mail.smtp.host" value="smtp.demo.com"/>
        <property name="mail.smtp.socketFactory.port" value="25"/>
        <property name="mail.smtp.user" value="demo@email.com"/>
        <property name="mail.smtp.password" value=""/>
        <property name="mail.smtp.socketFactory.class" value="javax.net.ssl.SSLSocketFactory"/>
        <property name="mail.smtp.auth" value="false"/>
        <property name="mail.smtp.port" value="25"/>
        <property name="mail.smtp.from" value="demo@email.com"/>
        <property name="mail.debug" value="true"/>
    </configuration>

Microsoft smtp.live.com Example

  
    <configuration0>
        <property name="mail.smtp.auth" value="true"/>
        <property name="mail.smtp.starttls.enable" value="true"/>
        <property name="mail.smtp.host" value="smtp.live.com"/>
        <property name="mail.smtp.socketFactory.port" value="25"/>
        <property name="mail.smtp.user" value="email@outlook.com"/>
        <property name="mail.smtp.password" value="mycomplexpassword"/>
        <property name="mail.smtp.socketFactory.class" value="javax.net.ssl.SSLSocketFactory"/>
        <property name="mail.smtp.auth" value="true"/>
        <property name="mail.smtp.port" value="25"/>
        <property name="mail.smtp.from" value="email@outlook.com"/>
        <property name="mail.debug" value="true"/>
    </configuration0>

Google gmail Example

    <configuration1>
        <property name="mail.smtp.auth" value="true"/>
        <property name="mail.smtp.starttls.enable" value="true"/>
        <property name="mail.smtp.host" value="smtp.gmail.com"/>
        <property name="mail.smtp.socketFactory.port" value="465"/>
        <property name="mail.smtp.user" value="email@gmail.com"/>
        <property name="mail.smtp.password" value="mycomplexpassword"/>
        <property name="mail.smtp.socketFactory.class" value="javax.net.ssl.SSLSocketFactory"/>
        <property name="mail.smtp.auth" value="true"/>
        <property name="mail.smtp.port" value="465"/>
        <property name="mail.smtp.from" value="email@gmail.com"/>
        <property name="mail.debug" value="true"/>
    </configuration1>