SMTPValve

Valve to send mail using an SMTP server .

Note: This valve is commonly used when sending notifications to users and administrators. NOT for sending one-time passwords.

Properties

Name Description Default value Mandatory Supports property expansion
mail_param_name Property containing the recipient mail address. mail No Yes
recipients Static comma separated list of recipients. Added to the recipient picked up in the flow. No No
userid_param_name Property containing the username. User-Name No Yes
mail_template The file path to the mail message template. resources/otp_mail_template.mustache No No
smtp_settings SMTP server Settings. Yes No
smtp_host SMTP host address. Overrides SMTP server Settings. No No
smtp_port SMTP port number. Overrides SMTP server Settings. 587 No No
smtp_from_address The from mail address. Overrides SMTP server Settings. No No
smtp_username Username for the smtp account. Overrides SMTP server Settings. No No
smtp_password Password for the smtp account. Overrides SMTP server Settings. No No
start_tls_enabled true No No
ssl_on_connect false No No
ssl_check_server_identity false No No
socket_connection_timeout Timeout in seconds. 15 No No
removal_prefixes Prefixes to be removed as a comma separated list. smtp:,SMTP:,sip: No No
attachment_param_name Parameter containing the attachement data. Looks at request parameters first and item parameters secondly. No No
attachment_name_param_name Parameter containing the attachement name. Looks at request parameters first and item parameters secondly. No No
message_subject_key Locale key for the mail message subject. Found in lang/*/strings.xml valves.delivery.smtp.message.subject No No
message_body_key Locale key for the mail message body. Found in lang/*/strings.xml valves.delivery.smtp.message.body No No
message_subject Static, non localizeable message. Overrides message_subject_key parameter. No No
message_body Static, non localizeable message. Overrides message_body_key parameter. No No

Example Configuration

A connection to SMTP can be made using scenario's in PhenixID configuration portal.
So some of the parameters will be contained within that global smtp configuration.
If a connection has been created already, the id for smtp_settings will be used and configuration will look similar to the first example.
More information about the Scenario for SMTP can be found here.

The valve can also be added with all the parameters, through the Advanced tab in PhenixID configuration portal.
Configuration will then look similar to the second example.

{
        "id": "27dffbf8-ff93-4766-918a-34b5423278df",
        "name": "SMTPValve",
        "enabled": "true",
        "config": {
              "smtp_settings": "fff21007-4fbe-450d-8aa2-3756a44745fa",
              "mail_template": "resources/otp_mail_template.mustache",
              "mail_param_name": "mail",
              "userid_param_name": "User-Name",
              "start_tls_enabled": "true",
              "ssl_on_connect": "false",
              "ssl_check_server_identity": "false",
              "socket_connection_timeout": "15",
              "removal_prefixes": "smtp:,SMTP:,sip:"
        }
}
{
        "name": "SMTPValve",
        "config": {
              "userid_param_name":"{{request.username}}",
              "mail_param_name": "{{item.mail}}",
              "mail_template" : "resources/myowntemplate.mustache",
              "recipients" : "user1@company.org,user2@company.org",
              "smtp_host" : "smtp.company.org",
              "smtp_port" : "587",
              "smtp_username" : "noreply@company.org",
              "smtp_password" : "{enc}Lsd28p9AMU1oAjwHgHprVdWmGteLZ6XYxY/AxkBusXg=",
              "smtp_from_address" : "noreply@company.org",
              "attachment_param_name": "document",
              "attachment_name_param_name": "MyDocument.txt",
              "message_subject": "Your subject text",
              "message_body": "Your body text"
        }
}

In the example above the value for attribute mail has been picked up earlier in the flow.

The value for userid_param_name has been picked up from the request. Most common values are {{request.User-Name}} for RADIUS and {{request.username}} for HTTP.

Requirements

Item set must have at least one entry.