Reply Email

Replies to a received email message.

Command availability: IBM RPA SaaS and IBM RPA on premises

Script syntax

IBM RPA's proprietary scripting language has a syntax similar to other programming languages. The script syntax defines the command's syntax in the script file. You can work with this syntax in IBM RPA Studio's Script mode.

emailReply --message(EmailMessage) [--addoriginalattachments(Boolean)] [--acceptinlineattachments(Boolean)] [--from(String)] [--cc(List<String>)] [--bcc(List<String>)] [--subject(String)] [--bodytype(BodyType)] --body(String) [--attachments(List<String>)] [--headers(StringDictionary<Variant>)] [--labels(List<String>)]

Dependencies

Input parameter

The following table displays the list of input parameters available in this command. In the table, you can see the parameter name when working in IBM RPA Studio's Script mode and its Designer mode equivalent label.

Designer mode label Script mode name Required Accepted variable types Description
Message message Required Email Message Variable of type Email Message that contains the email message to reply to.
Add Original Attachments addoriginalattachments Optional Boolean Use to include attachments from the original message in the reply.
Accept Inline Attachments acceptinlineattachments Optional Boolean Use to list the attachments that come in the email body.
From from Optional Text Email address of the sender of the message.
Cc cc Optional List <Text> List with the email addresses of the recipients that receive a copy of the message.
Bcc bcc Optional List <Text> List with the email addresses of the recipients that should receive a blind copy of the sent message.
Subject subject Optional Text The subject of the email message that is sent.
Body Type bodytype Optional BodyType Type of text that will compose the body of the email message.

See the bodytype parameter options.
Email Body body Required Text Text that composes the body of the email message, according to the type of formatting specified in the bodytype parameter.
Attachments attachments Optional List <Text> List with the path of the files that will be attached to the email message.
Headers headers Optional String Dictionary <Any> Key and value referring to the information about the message to be sent, as sender, recipient and server, or any other information that needs to be attached to the header.
Categories labels Optional List <Text> Category External link of classification of the email message that will be replied.

bodytype parameter options

The following table displays the options available for the bodytype input parameter. The table shows the options available when working in Script mode and the equivalent label in the Designer mode.

Designer mode label Script mode name Description
Html html Text in html format.
Rtf Rtf Text in rtf format.
Text Text Plain text.

Example

The command responds to the sender's email address.

defVar --name emailConnection --type EmailConnection
defVar --name answeredMessage --type EmailMessage
defVar --name emailsList --type List --innertype String --value "[senderemail@email.com]"
defVar --name emailSubject --type String
defVar --name emailBody --type String
defVar --name receivedDate --type DateTime
imapConnect --mailhost "outlook.office365.com" --mailport 993 --usessl  --UseConnectionToSend  --smtpcredentials  --smtphost "smtp.office365.com" --smtpport 587 --smtpusername "useremail@email.com" --smtppassword userpassword --smtpusessl  --username "useremail@email.com" --mailusername "useremail@email.com" --mailpassword userpassword --enableLog  emailConnection=value
emailApplySearchFilters --from ${emailsList} --subjectdirective "All" --wordsdirective "All" --connection ${emailConnection}
foreach --collection "${emailConnection}" --variable "${answeredMessage}"
emailRead --message ${answeredMessage} emailSubject=subject emailBody=body receivedDate=receiveddate
emailReply --message ${answeredMessage} --subject Test --bodytype "Text" --body "Answering your email"
endFor
emailDisconnect --connection ${emailConnection}
// Demonstrates the sending of an email replying to a received message.
Note:Use a valid email connection to run this example script.