Skip to main content

Email - Send Message Conditionally

Overview​

Send a message to anyone in the world using email, attaching one or more files.

To have Shipyard dynamically parse and output the contents of a file, you can include the filename in this format: {{text:file.txt}}

To upload multiple files, use Regex Match Type.

Due to email file size constraints, when the the total file size >10MB, Shipyard will automatically zip the files under the name "Archive.zip".

Note: This Vessel cannot be used to access a local file from your computer.

Recommended Setup:

  1. A Vessel built with this Blueprint should typically run after a Vessel that either downloads a file to Shipyard or generates a file with code.

Variables​

NameReferenceTypeRequiredDefaultOptionsDescription
Send MethodEMAIL_SEND_METHODSelectβœ…tlsSSL: ssl

TLS: tls

Determines how you want to send the email. Options are TLS and SSL. We generally suggest using TLS when possible.
SMTP HostEMAIL_SMTP_HOSTAlphanumericβœ…--The server where your email will be sent from. Usually formatted as smtp.domain.com
SMTP PortEMAIL_SMTP_PORTAlphanumericβœ…--The port from which your email will be sent. Commonly used ports are 25, 465, and 587. We generally suggest using 587 with TLS.
UsernameEMAIL_USERNAMEAlphanumericβœ…--The username that your email provider uses to identify your access to send email.
PasswordEMAIL_PASSWORDPasswordβœ…--The password associated with your username.
Sender AddressEMAIL_SENDER_ADDRESSAlphanumericβœ…--The email address you want recipients to see when you send an email. We generally suggest keeping the sender address as your own email to ensure that you can appropriately receive replies.
Sender NameEMAIL_SENDER_NAMEAlphanumericβž–--The name you want users to see that the email is from. If left blank, the Sender Address will be used.
ToEMAIL_TOAlphanumericβž–--The email(s) that you want to send a message to. Can be comma-separated to include multiple email addresses.
CCEMAIL_CCAlphanumericβž–--The email(s) that you want your message to be carbon copied (CCed) to. Can be comma-separated to include multiple email addresses.
BCCEMAIL_BCCAlphanumericβž–--The email(s) that you want to be blind carbon copied (BCCed) to. Can be comma-separated to include multiple email addresses. Emails in this field will receive the email, but will not have their email exposed to all other recipients.
SubjectEMAIL_SUBJECTAlphanumericβž–--The subject of the email that you want to send.
MessageEMAIL_MESSAGEAlphanumericβœ…--The body of the email, containing your main message. This field supports plain text as well as HTML. The body of the email, containing your main message. This field supports plain text as well as HTML. To have Shipyard dynamically parse and output the contents of a file, you can include the filename in this format: {{text:file.txt}}
Send Messages Only WhenEMAIL_CONDITIONAL_SENDSelectβœ…file_existsFile(s) Exist: file_exists

File(s) Don't Exist: file_dne

Determines what condition needs to be met for a message to send. File(s) Exist - Send the message only if a file can be found using the provided folder/filename.ext combination. File(s) Don't Exist - Send the message only if a file cannot found using the provided folder/filename.ext combination.
File Name Match TypeEMAIL_SOURCE_FILE_NAME_MATCH_TYPESelectβœ…exact_matchRegex: regex_match

Exact: exact_match

Determines if the text in "File Name" will look for one file with exact match, or multiple files using regex.
File NameEMAIL_SOURCE_FILE_NAMEAlphanumericβž–--Name of the target file on Shipyard. Can be regex if "Match Type" is set accordingly
Folder NameEMAIL_SOURCE_FOLDER_NAMEAlphanumericβž–--Name of the local folder on Shipyard to upload the target file from. If left blank, will look in the home directory.
Include Shipyard Footer?EMAIL_INCLUDE_SHIPYARD_FOOTERBooleanβœ…True-Determines if a footer should be sent with the email that links back to the originating Vessel or Fleet.

YAML​

Below is the YAML template for this Blueprint and can be used in the Fleet YAML Editor.

source:
blueprint: Email - Send Message Conditionally
inputs:
EMAIL_SEND_METHOD: tls ## REQUIRED
EMAIL_SMTP_HOST: null ## REQUIRED
EMAIL_SMTP_PORT: null ## REQUIRED
EMAIL_USERNAME: null ## REQUIRED
EMAIL_PASSWORD: null ## REQUIRED
EMAIL_SENDER_ADDRESS: null ## REQUIRED
EMAIL_SENDER_NAME: null
EMAIL_TO: null
EMAIL_CC: null
EMAIL_BCC: null
EMAIL_SUBJECT: null
EMAIL_MESSAGE: null ## REQUIRED
EMAIL_CONDITIONAL_SEND: file_exists ## REQUIRED
EMAIL_SOURCE_FILE_NAME_MATCH_TYPE: exact_match ## REQUIRED
EMAIL_SOURCE_FILE_NAME: null
EMAIL_SOURCE_FOLDER_NAME: null
EMAIL_INCLUDE_SHIPYARD_FOOTER: true ## REQUIRED
type: BLUEPRINT
guardrails:
retry_count: 1
retry_wait: 0h0m0s
runtime_cutoff: 1h0m0s
exclude_exit_code_ranges:
- '102'
- '104'
- '200'
- '201'
- '203'