Disconnect from Email Server
Disconnects from an email server.
Command availability: IBM RPA SaaS and IBM RPA on premises
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.
emailDisconnect --connection(EmailConnection)
Dependencies
-
Use the following commands to connect to an email server:
- Connect to Exchange Email Server (
exchangeConnect
) - Connect to IMAP Email Server (
imapConnect
) - Connect to Microsoft Outlook (
microsoftMailConnect
) - Connect to SMTP Server (
smtpConnect
)
- Connect to Exchange Email Server (
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 |
---|---|---|---|---|
Connection | connection |
Required |
Email Connection |
Variable with the collection that contains the account's email messages. |
Example
After connecting to an IMAP email server and sending an email message, the connection is terminated by using the Disconnect from Email Server command.
defVar --name emailConnection --type EmailConnection
defVar --name destinatary --type List --innertype String --value "[user1@gmail.com,user2@hotmail.com]"
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
// Envio de um emails após uma conexão estabelecida.
emailSend --connection ${emailConnection} --to ${destinatary} --from "useremail@email.com" --subject "Disconnect Server" --bodytype "Text" --body "Good Evening!\r\n\r\nWe ask that the connection to the email server should be interrupted.\r\n"
emailDisconnect --connection ${emailConnection}