Update Email Information
Updates the information in the "Subject" and "Category" fields of an email message.
Command availability: IBM RPA SaaS and IBM RPA on premises
Description
Updates the information in the "Subject" and "Category" fields of an email message.
Script syntax
IBM RPA's proprietary script 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.
emailUpdate --message(EmailMessage) [--subject(String)] [--labels(List<String>)]
Dependencies
-
Use the For Each (
forEach) command to get email message instances. Otherwise, the command will only return the first result. -
Use the following commands to connect to an email server:
-
Connect to Exchange Email Server (
exchangeConnect) -
Connect to Outlook Server (
outlookConnect)
-
Limitations
This command does not work with the Connect to IMAP Email Server (imapConnect) command.
Input parameters
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 to have the "Subject" and "Category" fields updated. |
| Subject | subject |
Optional |
Text |
New content that will update the existing content in the "Subject" field of the message. Note: The variable containing the subjects of the email that will be updated is obtained through the Subject output, from the Read Email (emailRead) command. |
| Categories | labels |
Optional |
List<Text> |
New category that will update the existing one in the "Category" field of the message. Note: The variable containing the categories Categories, output from the Read Email (emailRead) command. |
Example
The command updates the information contained in an email message, changing its subject and adding a new category.
defVar --name emailConnection --type EmailConnection
defVar --name messageRead --type EmailMessage
defVar --name emailSubject --type String
defVar --name categoryRead --type List --innertype String
defVar --name updatedCategory --type List --innertype String --value "[NewCategory,Test]"
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 --enableLogemailConnection=value
foreach --collection "${emailConnection}" --variable "${messageRead}"
emailRead --message ${messageRead} emailSubject=subject categoryRead=labels
emailUpdate --message ${messageRead} --subject UpdateSubject --labels ${updatedCategory}
endFor
emailDisconnect --connection ${emailConnection}
// The subject and category of the email has been updated.