Back to index
Summary
Send an email message.This command also facilitates sending an email from the command line or a command job step without setting up an email notifier. This API is more dynamic than an email notifier because you do not need to set up a template beforehand. This API also makes sending email attachments easier than using a notifier template.
Instead of, or in addition to, specifying a configName
, any of the configuration options for an email configuration can be specified as options. These options are: mailHost
, mailPort
, mailFrom
, mailUser
, and mailUserPassword
.
If both a configName and configuration options are specified, the specified options override values stored in the configuration. In this case, the user must have both Modify and Execute permissions on the configuration.
|
attachmentArrayoptionalAttachments for the email. bccArrayoptionalA user name or email address to include in the Bcc: header element.ccArrayoptionalA user name or email address to include in the Cc: header element.configNameStringoptionalThe email configuration name. credentialNameStringoptionalThe name of the credential that contains the email password for the user from which CloudBees CD/RO sends email notifications. credentialProjectNameStringoptionalThe name of the credential project that contains the email password for the user from which CloudBees CD/RO sends email notifications. headerArrayoptionalA raw RFC 822 header-line. htmlStringoptionalThe html text body of the message. inlineArrayoptionalInline attachments. mailFromStringoptionalThe email address used as the email sender address for CloudBees CD/RO notifications. mailHostStringoptionalName of the email server host. mailPortIntegeroptionalThe port number for the email service on the server. mailProtocolStringoptionalName of the email transport protocol. Supported protocol names: SMTP , SMTPS .mailUserStringoptionalName of the email user on behalf of which CloudBees CD/RO sends email notifications. mailUserPasswordStringoptionalPassword of the email user on behalf of which CloudBees CD/RO sends email notifications. multipartModeStringoptionalThe multipart message mode. Defaults to none for single part messages and mixedRelated for messages with multiple parts.Possible values: "mixed" , "mixedRelated" , "none" , "related" rawStringoptionalA raw RFC 822 mail message including headers and body. subjectStringoptionalThe Subject header field of the message.textStringoptionalThe plain text body of the message. toArrayoptionalA user name or email address to include in the To: header element. |
Usage
Perl
$cmdr->sendEmail( # optionals );
ectool
ectool sendEmail \ # optionals
Examples
Perl
$cmdr->sendEmail({ configName => 'config1', subject => 'Test message', to => ['user1', 'user2'], html => '<html><body>Some stuff</body></html>', inline => [{contentId => 'image1', fileName => 'image1.jpg'}, {contentId => 'image2', fileName => 'image2.jpg'}], attachment => ['report1.html', 'report2.pdf'] })
ectool
Options that take multiple values may be specified as a single option with each value as a separate argument or as multiple options, each with a single argument. |
ectool sendEmail \ --to user1 \ --to user2 \ --subject Test \ --html '<html><body>Some stuff</body></html>' \ --inline image1=image1.jpg \ --inline image2=image2.jpg \ --attachment report1.html \ --attachment report2.pdf ectool sendEmail \ --to user1 user2 \ --subject Test \ --html '<html><body>Some stuff</body></html>' \ --inline image1=image1.jpg image2=image2.jpg \ --attachment report1.html report2.pdf