EMAIL: Difference between revisions

From Commander4j
No edit summary
 
Line 3: Line 3:
'''config.xml'''
'''config.xml'''
<syntaxhighlight lang="xml">
<syntaxhighlight lang="xml">
    <map id="map02" enabled="Y" description="Email Send PDF">
      <map>
        <input id="in1" description="Read File">
        <id>Map05</id>
            <type>EMAIL</type>
        <enabled>true</enabled>
            <mask>pdf</mask>
        <description>Send File via Email</description>
            <path>./interface/input/421 (GEN Email Send)</path>
        <enableEmailNotifications>true</enableEmailNotifications>
            <pollingInterval>2000</pollingInterval>
        <connectors>
        </input>
            <input>
        <output id="out1" enabled="Y" description="Send Email">
              <id>in1</id>
            <path>./interface/output/421 (GEN Email Send)</path>
              <description>Read File</description>
            <type>EMAIL</type>
              <type>EMAIL</type>
            <subject>Test email of PDF document</subject>
              <url>
            <message>PDF Attached.</message>
                  <path>./interface/input/Map05 File to EMAIL</path>
            <emailListID>PDF</emailListID>
                  <mask/>
        </output>
                  <prefix/>
    </map>
                  <pollingInterval>1000</pollingInterval>
              </url>
            </input>
            <output>
              <id>out1</id>
              <enabled>true</enabled>
              <description>Email File</description>
              <type>EMAIL</type>
              <url>
                  <path>./interface/output/Map05 File to EMAIL</path>
                  <prefix/>
                  <fileExtension/>
                  <use83GUID>false</use83GUID>
              </url>
              <email>
                  <emailListID>Excel</emailListID>
                  <subject>Test Email</subject>
                  <message>See Attached File</message>
              </email>
            </output>
        </connectors>
      </map>
</syntaxhighlight>
</syntaxhighlight>



Latest revision as of 14:33, 30 December 2024

EMAIL Map Configuration

config.xml

      <map>
         <id>Map05</id>
         <enabled>true</enabled>
         <description>Send File via Email</description>
         <enableEmailNotifications>true</enableEmailNotifications>
         <connectors>
            <input>
               <id>in1</id>
               <description>Read File</description>
               <type>EMAIL</type>
               <url>
                  <path>./interface/input/Map05 File to EMAIL</path>
                  <mask/>
                  <prefix/>
                  <pollingInterval>1000</pollingInterval>
               </url>
            </input>
            <output>
               <id>out1</id>
               <enabled>true</enabled>
               <description>Email File</description>
               <type>EMAIL</type>
               <url>
                  <path>./interface/output/Map05 File to EMAIL</path>
                  <prefix/>
                  <fileExtension/>
                  <use83GUID>false</use83GUID>
               </url>
               <email>
                  <emailListID>Excel</emailListID>
                  <subject>Test Email</subject>
                  <message>See Attached File</message>
               </email>
            </output>
         </connectors>
      </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>