Mail Properties Not Working

Scenario:

Mail options (sender, recipient, headers, etc) not showing.

Steps to reproduce:

Create a project with sequence. Use “Get outlook mails” to get emails, and assign output to a list (ctrl-k) called “messages”. Now use a foreach “mail in messages” loop, and messageBox “mail.sender” (for example)

Current Behavior:

When I type mail. the only suggestions are “Equals”, “GetHashCode”, “GetType” & “ToString”. Other options neither appear nor work. I have the UiPath.Mail.Activities package installed.

Expected Behavior:

I expect all the mail options such as sender, recipient, headers etc to appear.

Studio/Robot/Orchestrator Version: 2017.1.6435

Last stable behavior:
Last stable version:
OS Version:
Windows 10 Pro. Version 1703. OS Build 15063.540.
Others if Relevant: (workflow, logs, .net version, service pack, etc):

Hi,
Doesn’t For each activity have a property for data type?

I’m using a bit old version and it has the property, there I need to choose correct data type according to the items that I want to iterate through (in your case, MailMessage)
Otherwise the items will be assumed as a collection of Object.

2 Likes

Hi,
please change the argument type of foreach item from object to system.net.mail.mailmessages.

net

PS: If its not listed in the tab then click on browser for type and search for argument.

2 Likes

Whoops I feel kind of silly now … one of those days :slight_smile:

Thanks a million!

I have a similar issue but it’s not due to a for each. I have a mail message but cannot get the mail.sender property (subject, body and headers(“date”) are fine).

I get an object reference not set to an instance of an object error

It’s only doing this for one email.