# ActionDetails_Str

VALUE:
Dim objOutlook
Set objOutlook = CreateObject("Outlook.Application")

Dim objEmail
Set objEmail = objOutlook.CreateItem(0)

Dim strEmailReceiver, strEmailCc, strEmailBcc, strEmailSubject, strEmailBody, strEmailAttachments
RPAEngine.GetVar "EmailReceiver",


VALUE:
strEmailReceiver
RPAEngine.GetVar "EmailCc", strEmailCc
RPAEngine.GetVar "EmailBcc", strEmailBcc
RPAEngine.GetVar "EmailSubject", strEmailSubject
RPAEngine.GetVar "EmailBody", strEmailBody
RPAEngine.GetVar "EmailAttachments", strEmailAttachments

With obj


VALUE:
Email
  .To = strEmailReceiver
  .Cc = strEmailCc
  .Bcc = strEmailBcc
  .Subject = strEmailSubject
  .Body = strEmailBody

  If (strEmailAttachments <> "") Then
    .Attachments.Add strEmailAttachments
  End If
  .Send
End With

'Clear the memory
Set obj


VALUE:
Outlook = Nothing
Set objEmail = Nothing


VALUE:
Dim objOutlook, objNamespace, objFolder
Set objOutlook = CreateObject("Outlook.Application")
Set objNamespace = objOutlook.GetNamespace("MAPI")
Set objFolder = objNamespace.GetDefaultFolder(6)

Dim strFolder
RPAEngine.GetVar "EmailsFolder", strFolder

If


VALUE:
(strfolder <> "Inbox") Then

	Set objFolder = objFolder.Folders(strFolder)

End If

RPAEngine.SetVar "Emails", objFolder.Items.Count

'Clear the memory
Set objOutlook = Nothing
Set objNamespace = Nothing
Set objFolder = Nothing


VALUE:
(strfolder <> "Inbox") Then
	Set objFolder = objFolder.Folders(strFolder)
End If

Dim colItems
Set colItems = objFolder.Items

Dim intEmail
RPAEngine.GetVar "CurrentEmail", intEmail

Dim objEmail
Set objEmail = colItems(colItems.Count - (intEmail - 1))

R


VALUE:
PAEngine.SetVar intEmail & "EmailID", objEmail.EntryID
RPAEngine.SetVar intEmail & "EmailDate", objEmail.ReceivedTime
RPAEngine.SetVar intEmail & "EmailUnread", objEmail.UnRead
RPAEngine.SetVar intEmail & "EmailSender", objEmail.Sender & " (" & objEmail.S


VALUE:
enderEmailAddress & ")"
RPAEngine.SetVar intEmail & "EmailCc", objEmail.Cc
RPAEngine.SetVar intEmail & "EmailSubject", objEmail.Subject
RPAEngine.SetVar intEmail & "EmailBody", objEmail.Body
RPAEngine.SetVar intEmail & "EmailBodyHTML", objEmail.HTMLBody
R


VALUE:
PAEngine.SetVar intEmail & "EmailAttachments", objEmail.Attachments.Count

Dim intAttachment, strAttachments
For intAttachment = 1 to objEmail.Attachments.Count

	If (intAttachment = 1) Then

		strAttachments = objEmail.Attachments.Item(intAttachment).Dis


VALUE:
playName

	Else

		strAttachments = strAttachments & ", " & objEmail.Attachments.Item(intAttachment).DisplayName

	End If

Next

RPAEngine.SetVar  intEmail & "EmailAttachmentNames", strAttachments

'Clear the memory
Set objOutlook = Nothing
Set objEmail =


VALUE:
Nothing
Set objNamespace = Nothing
Set objEmail = Nothing

Set colItems = Nothing


VALUE:
Dim objOutlook, objNamespace
Set objOutlook = CreateObject("Outlook.Application")
Set objNamespace = objOutlook.GetNamespace("MAPI")

Dim intEmail
RPAEngine.GetVar "CurrentEmail", intEmail

Dim objEmail, strEmailID
RPAEngine.GetVar intEmail & "EmailID", s


VALUE:
trEmailID
Set objEmail = objNamespace.GetItemFromID(strEmailID)

Dim objFileSystem, blnFilePathExists
Set objFileSystem = CreateObject("Scripting.FileSystemObject")

Dim strFilePath, strFileName
RPAEngine.GetVar "FolderDestinationAttachmentDownload", strF


VALUE:
ilePath

On Error Resume Next
objFileSystem.CreateFolder(strFilePath)
objFileSystem.CreateFolder(strFilePath & "\" & strEmailID)
On Error GoTo 0

RPAEngine.GetVar intEmail & "EmailSubjectClean", strFileName

objEmail.SaveAs strFilePath & "\" & strEmailID


VALUE:
& "\" & strFileName & ".msg"

'Clear the memory
Set objOutlook = Nothing
Set objNamespace = Nothing
Set objEmail = Nothing
Set objAttachments = Nothing

Set objFileSystem = Nothing


VALUE:
ilePath

On Error Resume Next
objFileSystem.CreateFolder(strFilePath)
On Error GoTo 0

Dim objAttachments
Set objAttachments = objEmail.Attachments

Dim intAttachmentCount
intAttachmentCount = objAttachments.Count

Dim intAttachmentCurrent
For intAttachme


VALUE:
ntCurrent = 1 to intAttachmentCount

	strFileName = objAttachments.Item(intAttachmentCurrent).FileName

	On Error Resume Next
	objFileSystem.CreateFolder(strFilePath & "\" & strEmailID)
	On Error GoTo 0

	strFileName = strFilePath & "\" & strEmailID & "\"


VALUE:
& strFileName

	objAttachments.Item(intAttachmentCurrent).SaveAsFile strFileName

Next

'Clear the memory
Set objOutlook = Nothing
Set objNamespace = Nothing
Set objEmail = Nothing
Set objAttachments = Nothing

Set objFileSystem = Nothing


VALUE:
Dim objOutlook, objNamespace, objFolder
Set objOutlook = CreateObject("Outlook.Application")
Set objNamespace = objOutlook.GetNamespace("MAPI")

Dim intEmail
RPAEngine.GetVar "CurrentEmail", intEmail

Dim objEmail, strEmailID
RPAEngine.GetVar intEmail & "


VALUE:
EmailID", strEmailID
Set objEmail = objNamespace.GetItemFromID(strEmailID)

Dim objEmailReply
Set objEmailReply = objEmail.ReplyAll

Dim strEmailBody, strEmailAttachments
RPAEngine.GetVar "EmailBody", strEmailBody
RPAEngine.GetVar "EmailAttachments", strE


VALUE:
mailAttachments

With objEmailReply
  
  .HTMLBody = strEmailBody & vbCrLf & .HTMLBody
  If (strEmailAttachments <> "") Then
    .Attachments.Add strEmailAttachments
  End If

  .Send

End With

'Clear the memory
Set objOutlook = Nothing
Set objNamespace


VALUE:
= Nothing
Set objEmail = Nothing
Set objEmailReply = Nothing


VALUE:
EmailID", strEmailID
Set objEmail = objNamespace.GetItemFromID(strEmailID)

Dim objEmailForward
Set objEmailForward = objEmail.Forward

Dim strEmailReceiver, strEmailCc, strEmailBcc, strEmailBody
RPAEngine.GetVar "EmailReceiver", strEmailReceiver
RPAEngin


VALUE:
e.GetVar "EmailCc", strEmailCc
RPAEngine.GetVar "EmailBcc", strEmailBcc
RPAEngine.GetVar "EmailBody", strEmailBody

With objEmailForward
  
  .To = strEmailReceiver
  .Cc = strEmailCc
  .Bcc = strEmailBcc
  .HTMLBody = strEmailBody & vbCrLf & .HTMLBody


VALUE:
.Send

End With

'Clear the memory
Set objOutlook = Nothing
Set objNamespace = Nothing
Set objEmail = Nothing
Set objEmailForward = Nothing


VALUE:
Dim objOutlook, objNamespace, objFolder
Set objOutlook = CreateObject("Outlook.Application")
Set objNamespace = objOutlook.GetNamespace("MAPI")
Set objFolder = objNamespace.GetDefaultFolder(6)

Dim strFolderSub
RPAEngine.GetVar "EmailMoveToFolder", strFol


VALUE:
derSub

Dim objFolderSub
Set objFolderSub = objFolder.Folders(strFolderSub)

Dim intEmail
RPAEngine.GetVar "CurrentEmail", intEmail

Dim objEmail, strEmailID
RPAEngine.GetVar intEmail & "EmailID", strEmailID
Set objEmail = objNamespace.GetItemFromID(strEm


VALUE:
ailID)

objEmail.Move objFolderSub

'Clear the memory
Set objOutlook = Nothing
Set objNamespace = Nothing
Set objEmail = Nothing
Set objFolder  = Nothing
Set objFolderSub = Nothing


VALUE:
EmailID", strEmailID
Set objEmail = objNamespace.GetItemFromID(strEmailID)

objEmail.Delete

'Clear the memory
Set objOutlook = Nothing
Set objNamespace = Nothing
Set objEmail = Nothing


# Actions

NOTES:
The script below can be implemented to send an email


NOTES:
DECLARE! The email address(es) to receive the email
IMPORTANT: This script is only designed to support one receiver. Comma separated receivers is NOT supported.


NOTES:
DECLARE! The email address(es) to be Cc on the email
IMPORTANT: This script is only designed to support one receiver. Comma separated receivers is NOT supported.


NOTES:
DECLARE! The email address(es) to be Bcc on the email
IMPORTANT: This script is only designed to support one receiver. Comma separated receivers is NOT supported.


NOTES:
DECLARE! The email attachment(s), comma separated


NOTES:
The script below can be implemented to loop through emails


NOTES:
Create a variable to store the total number of emails


NOTES:
DECLARE! Default is "Inbox" (=main inbox). You may define a subfolder under the main inbox folder


NOTES:
Retrieve the number of emails in the inbox


NOTES:
Create a variable to store the current loop number


NOTES:
Create a variable to store the current email ID


NOTES:
Create a variable to store the date and time of the received email


NOTES:
Create a variable to store a true (=unread) or false (=read) value


NOTES:
Create a variable to store the current email sender


NOTES:
Create a variable to store the current email Cc


NOTES:
Create a variable to store the current email subject


NOTES:
Create a variable to store the current email body


NOTES:
Create a variable to store the current email body HTML


NOTES:
Create a variable to store the total number of attachments of the current email


NOTES:
Create a variable to store the names of the attachments of the current email


NOTES:
Retrieve email properties from current email


NOTES:
DECLARE! The folder to store the downloaded email files and attachments


NOTES:
Create a variable with a clean string of the email subject to use as the name of the email msg file


NOTES:
DECLARE! The email attachment(s) of the reply, comma separated


NOTES:
DECLARE! The name of the folder to move the email to


