Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Table of Contents
outlinh1. true
outlinh1. true
1printablefalse
2stylh1. none
3indent20px

Introduction

The JITL MailJob template can be used by a job to send mail from an Agent.

  • The job template makes use of the SMTP protocol to send mail.
  • The job template can be used to specify settings from different sources:
    • Connection Settings
      • This These includes settings such as the SMTP host, port etc.
      • It is recommended to use that JS7 - Job Resources are used for this purpose as such settings tend to use the same values for any mail that should be sent.
    • Mail Settings
      • Such settings are specific for individual mail mails and include e.g. , for example, the subject and body of the mail.
  • The job template can be used with a JS7 - Credential Store.

Usage

When defining the job considereither:

  • to invoke the Wizard that is available from the job properties tab in the Configuration view and to select the JITL MailJob and respective relevant arguments from the Wizard

or

  • to specify the JITL job class and com.sos.jitl.jobs.mail.MailJob Java class name , then and add arguments specifying what to send and where to send mail should be sent as explained from in the documentation below documentation.

Example

Download (upload .json)pdwNotificationSOSMailPlainText.json

...

  • Required arguments include the to argument to specify the recipient of mail.
  • Any other arguments are optional, provided that a job resource is used that specifies connection details to your mail server, see below. Otherwise individual settings such as the SMTP host, SMTP port etc. can be specified from arguments.
  • Select the check box provided with each argument if you want this argument to be added to the arguments of the mail job MailJob template.

When hitting the "Submit" button the wizard adds the required arguments to your the job that which should look like this:


The job arguments can be specified:

  • from individual variables as offered by configured using the job wizard.,
  • by use of job resourcesusing JS7 - Job Resources.

Use of Job

...

Resources for Mail Settings

A number of settings for sending mail most probably carry the same values when used for different mail jobs. This includes e.g. use of These include, for example, the SMTP host, SMTP port etc.

...

A job resource has two parts, one being the variables that can be specified like this from the "Arguments" sub-tab as shown here:


Explanation:

  • The variable names specified are selected to match use those used with the JITL MailJob template.
  • Consider Note the use of variable names that start with mail.smtp.
    • These variable names correspond to Java properties available with the JavaMail API. Any of the JavaMail properties can be specified.
    • Find You will find a full list of the available mail.smtp. properties from https://javaee.github.io/javamail/docs/api/com/sun/mail/smtp/package-summary.html
    • Required properties include (but are not limited to):
      • mail.smtp.host
      • mail.smtp.port
    • When using a secure SSL connection note that:
      • to use TLS, the mail.smtp.starttls.enable argument has to be used with the value true, to use SSL, the mail.smtp.ssl.enable argument has to be used with the value true.
      • different ports might be in use: for unencrypted connections port 25 is frequently used, for TLS connections port 465 or 587 is frequently used, for SSL connections port 587 is frequently used.
      • optionally use the mail.smtp.ssl.protocols argument with a value such as TLSv1.2 or TLSv1.1,TLSv1.2 to specify one or more protocol versions that limit handshake with the mail server to the protocol versions specified. Depending on the Java version in use and possible modifications of the java.security file a number of protocols could be enabled that might not match the mail server's capabilities. Typically SSL handshaking starts from the highest protocol version accepted by both parties. However, it is not guaranteed that protocol negotiation will work perfectly. In such a situation it is recommended that the protocol version is specified using this argument.
    • For authentication the following settings are used:
      • the mail.smtp.user setting is assigned the SMTP user account.
      • the mail.smtp.password setting is assigned the password.
    • When using OAuth2 authentication then the following settings are used:
      • the mail.smtp.auth setting is assigned the value true.
      • the mail.smtp.auth.mechanisms setting is assigned the value XOAUTH2.
      • the mail.smtp.user setting is assigned the OAuth2 user account.
      • the mail.smtp.password setting is assigned the OAuth2 access token.
      • Some mail servers such as smtp.office365.com might require the older SASL mechanism to be used:
        • the mail.smtp.sasl.mechanisms.oauth2.oauthToken setting is assigned the OAuth2 access token.
        • the mail.smtp.password setting is not specified.

The second part of a job resource is available with accessed using the "Environment Variables" sub-tab as shown here:


Explanation:

  • Values of environment variables are assigned the corresponding variables as explained with in the previous chaptersectio.
  • The purpose of the "Environment Variables" sub-tab is to propagate variables to shell jobs, should you operate jobs that require such environment variables for parameterization purposes.
  • Consider Note that the JITL MailJob is a job running in the Java Virtual Machine. It is not a shell job and therefore does not use environment variables.

Assigning a Job Resource for Mail Settings

With Once a job resource being has been created and deployed it can be assigned the JITL MailJob to populate the job's arguments from the job resource like thisas shown in this screenshot:

Documentation

The Job Documentation including the full list of arguments can be found underhttps://www.sos-berlin.com/doc/JS7-JITL/MailJob.xml

...

NameRequiredDefault ValuePurposeExample
toyes
list of mail recipient's e-mail address, multiple e-mail addresses are separated by comma or semicolonops@example.com

from

no

e-mail address used for sending mail

js7@example.com

from_name

no

the free-text name of the account that sends mail

JS7 JobScheduler

reply_to

no

if no replies should be accepted then typically use an e-mail address such as no-reply@example.com is used for the respective domain

no-reply@example.com

cc

no

e-mail address of carbon copy recipient, multiple e-mail addresses are separated by comma or semicolon


bccno
e-mail address of blind carbon copy recipient, multiple e-mail addresses are separated by comma or semicolon
subjectyes
the mail subject, consider to the use of ASCII 7bit characters
bodyyes
the mail body specified as plain text or HTML depending on the content_type setting
content_typenotext/plaina content type text/plain specifies plain text mail, a content type text/html specifies use of HTML mails.
encodingno7bitthe character encoding of subject and body, by default ASCII 7bit is used
charsetnoiso-8859-1by default Latin 1 (iso-8859-1) is used
attachmentno
the path to a file to be attached, multiple files are separated by commasemicolon
attachment_content_typenoapplication/octet-streamthe attachment content-type typically allows binary files
attachment_encodingnoBase64any attached files are encoded with printable base64 characters
attachment_charsetnoiso-8859-1by default Latin 1 (iso-8859-1) is used
mail.smtp.hostyes
the hostname or IP address of the SMTP server
mail.smtp.portno25the port of the SMTP server
mail.smtp.userno
the user account to be used in case that the SMTP server requires authentication
mail.smtp.passwordno
the password to be used in case that the SMTP server requires authentication
mail.smtp. ...no
any additional Java properties can be used as applicable to the JavaMail package
credential_store_fileno
Location of a credential store database (*.kdbx)./config/private/jobs.kdbx
credential_store_keyno
Location of a credential store key file (*.key)./config/private/jobs.key


The MailJob can be used with a credential store to hold sensitive arguments. For use of the credential_store_* arguments see JS7 - Use of Credential Store with JITL Jobs.

Further Resources

References

Display content by label
Labelsjs7 troubleshooting e-mail
OtherTitleTroubleshooting