Send a mail using invoke code


#1

Dim _app As Microsoft.Office.Interop.Outlook._Application=Nothing
Dim mail As Microsoft.Office.Interop.Outlook.MailItem=Nothing
_app=New Microsoft.Office.Interop.Outlook.ApplicationClass()

mail=CType(_app.CreateItem(Microsoft.Office.Interop.Outlook.OlItemType.olMailItem),Microsoft.Office.Interop.Outlook.MailItem)

mail.To=“your id”
mail.Subject=“TEest”
mail.Body=“robo test”
mail.Attachments.Add(“d:\test.xlsx”)
mail.Attachments.Add(“d:\sanj.xlsx”)
mail.Attachments.Add(“d:\Test_Modified_path.zip”)

mail.Importance=Microsoft.Office.Interop.Outlook.OlImportance.olImportanceNormal
CType(mail,Microsoft.Office.Interop.Outlook.MailItem).Send()


#2

Hello!

Nice :slight_smile:

Could you share the use case for this since we have the Send Email activities?

image

Regards,


#3

The main use case I can see if the ability to add attachments at run time. So for example you can read the contents of a folder and attach all the files found.
Using the Send Mail activities you cannot dynamically add attachments.