sendEmail

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.
attachment
Arrayoptional
Attachments for the email.
bcc
Arrayoptional
A user name or email address to include in the Bcc: header element.
cc
Arrayoptional
A user name or email address to include in the Cc: header element.
configName
Stringoptional
The email configuration name.
credentialName
Stringoptional
The name of the credential that contains the email password for the user from which CloudBees CD/RO sends email notifications.
credentialProjectName
Stringoptional
The name of the credential project that contains the email password for the user from which CloudBees CD/RO sends email notifications.
header
Arrayoptional
A raw RFC 822 header-line.
html
Stringoptional
The html text body of the message.
inline
Arrayoptional
Inline attachments.
mailFrom
Stringoptional
The email address used as the email sender address for CloudBees CD/RO notifications.
mailHost
Stringoptional
Name of the email server host.
mailPort
Integeroptional
The port number for the email service on the server.
mailProtocol
Stringoptional
Name of the email transport protocol. Supported protocol names: SMTP, SMTPS.
mailUser
Stringoptional
Name of the email user on behalf of which CloudBees CD/RO sends email notifications.
mailUserPassword
Stringoptional
Password of the email user on behalf of which CloudBees CD/RO sends email notifications.
multipartMode
Stringoptional
The multipart message mode. Defaults to none for single part messages and mixedRelated for messages with multiple parts.
Possible values: "mixed", "mixedRelated", "none", "related"
raw
Stringoptional
A raw RFC 822 mail message including headers and body.
subject
Stringoptional
The Subject header field of the message.
text
Stringoptional
The plain text body of the message.
to
Arrayoptional
A 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