An SMTP Credentials integration is used to send notifications for pipeline events using SMTP email.
Creating an SMTP Credentials Integration
To add this integration, follow the steps on the Managing Pipelines Integrations page.
Here is the information you need to create this integration:
Name -- choose a friendly name for the integration
Host -- endpoint to receive the payload
Port -- port to use to send the email
Host Name -- optional identifying label for the email
Email Sender -- optional sender email address
Email Auth User -- optional username for authorization to send the email
Email Auth Password -- optional password for authorization to send the email
Proxy -- optional proxy setting for the email server
Secure -- optional secure option to connect to the email server
ignoreTLS -- optional TLS option to connect to the email server without using TLS
Usage
The SMTP Credentials integration can be added directly to a step in the integrations
section.
The send_notification utility function can be used with a SMTP Credentials integration to send a notification message.
Example:
|
Default Environment Variables
When you add this integration to a step, a set of environment variables is automatically made available.
Environment variable | Description |
---|---|
| Name of the integration |
| Endpoint to receive the payload |
| Port to use to send the email |
| Identifying label for the email |
| Sender email address |
| Username for authorization to send the email |
| Password for authorization to send the email |
| Proxy setting for the email server |
| Secure option to connect to the email server |
| TLS option to connect to the email server without using TLS |
Example
This example uses an SMTP Credentials integration named notifySMTP.
The send_notification utility function is used to send the
onSuccess
andonFailure
notifications.The YAML for this example is available in this repository in the JFrog GitHub account.
Sending notifications
pipelines: - name: smtp_pipe steps: - name: test_step_1 type: Bash configuration: integrations: - name: notifySMTP # replace with friendly name of your SMTP Credentials integration execution: onSuccess: # replace 'notifySMTP' with the name of your SMTP Credentials integration - send_notification notifySMTP --recipients "buildalerts@mycompany.com" --subject "Build Succeeded" --body "built docker image 112.32.101.173:8081/docker-local/demo:$PIPELINE_NAME.$RUN_NUMBER" onFailure: # replace 'notifySMTP' with the name of your SMTP Credentials integration - send_notification notifySMTP --recipients "buildalerts@mycompany.com" --subject "Build Failed" --body "Failed docker image 112.32.101.173:8081/docker-local/demo:$PIPELINE_NAME.$RUN_NUMBER"