Introduction
A number of Arguments and Environment Variables for jobs are provided from the eMailDefault Job Resource. The Job Resource carries settings used to connect to a mail server.
The eMailDefault Job Resource is available for download
- The download link includes the JS7 branch of the JS7 product minor release for which the Job Resource will be used.
- https://download.sos-berlin.com/JobScheduler.2.7/Defaults.zip
- https://download.sos-berlin.com/JobScheduler.2.5/Defaults.zip
The Job Resource can be assigned workflows and jobs that require connection to a mail server, for details see JS7 - Job Resources
The eMailDefault Job Resource is not included with JS7 and is not updated/overwritten when updating JS7 products. The Job Resource is an example for frequently used settings.
Users are free to add individual settings to their needs.
Job Resource: eMailDefault
The Job Resource includes
- Arguments for use with Java jobs,
- Environment Variables for use with Shell jobs.
Both Arguments and Environment Variables hold the same values and are used depending on the job type for which the Job Resource is used.
Category | Argument | Environment Variable | Description | Sample Value |
---|---|---|---|---|
Required Settings | ||||
from | MAIL_SMTP_FROM | E-Mail address from which mail will be sent | js7@example.com | |
from_name | MAIL_SMTP_FROM_NAME | Name of the E-Mail account that sends mail | JS7 JobScheduler | |
reply_to | MAIL_SMTP_REPLY_TO | E-Mail address for replies to mails | no-reply@example.com | |
mail.smtp.host | MAIL_SMTP_HOST | Hostname or IP address of the mail server | mail.example.com | |
mail.smtp.port | MAIL_SMTP_PORT | SMTP Port of the mail server | 25 | |
Optional Settings | ||||
Timeouts | mail.smtp.timeout | MAIL_SMTP_TIMEOUT | Timeout in ms for responses of the mail server | 5000 |
mail.smtp.connectiontimeout | MAIL_SMTP_CONNECTIONTIMEOUT | Timeout in ms for establishing a connection to the mail server | 5000 | |
Protocols | mail.smtp.ssl.protocols | Specifies the protocol(s) in use, for example
| ||
mail.smtp.starttls.enable | Must be set to true if TLS is used to connect to the mail server. The mail.smtp.ssl.enable setting should be set to false . | |||
mail.smtp.ssl.enable | Must be set to true if SSL is used to connect to the mail server. The mail.smtp.starttls.enable setting should be set to false . | |||
Authentication | mail.smtp.user | Used for SMTP user/password authentication | ||
mail.smtp.password | Used for SMTP user/password authentication | |||
OAuth2 Authentication | mail.smtp.auth | Must be set to true if OAuth2 authentication is used. | ||
mail.smtp.auth.mechanisms | ||||
mail.smtp.sasl.mechanisms.oauth2.oauthToken | Holds an OAuth2 access token |
Explanation:
- Required Settings are included with the eMailDefault Job Resource.
- Optional Settings can be added by users.
- Note that e-mail settings are used for JS7 - Notifications - Configuration Element MailFragment.
- The names of Arguments and Environment Variables should not be changed.
- Any further Arguments and Environment Variables can be added that start with the prefix
mail.smtp.
andMAIL_SMTP_
respectively,- For example, to force support for TLS connections with a specific version of the protocol you can use:
- Argument:
mail.smtp.ssl.protocols,
value:TLSv1.2
Argument:
mail.smtp.starttls.enable
, value:true
- 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.
- the
- When using OAuth2 authentication then the following settings are used:
- the
mail.smtp.auth
setting is assigned the valuetrue
. - the
mail.smtp.auth.mechanisms
setting is assigned the valueXOAUTH2
. - 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
- the
- For example, to force support for TLS connections with a specific version of the protocol you can use:
- Find the list of available settings for JavaMail from : https://javaee.github.io/javamail/docs/api/com/sun/mail/smtp/package-summary.html
Further Resources
- JS7 - Job Resources
- JS7 - Job Environment Variables
- JS7 - Default Job Resource
- JS7 - Mail Server connection fails