Retrieving E-mail Body and Sender Details

Any luck?

i m not sure what you are trying to do and what its missing from our activity.
can you provide steps to reproduce and the actual vs expected behavior?

Yes. I am trying to get the Sender e-mail address (which is not same as From address). Sender is defined when sending an e-mail from a shared account.

Steps: load the messages from Outlook and iterate them to see the From and Sender fileds. Get Outlook Messeges → For each → Try Catch: Try → write line (message.Sender.Address) → Catch → write line (message.From.Address).

“From” field is set in majority of cases (unless you are processing a message which was not sent at all for example). While “Sender” field is NEVER defined in UIPath, even when the Outlook message has this field (which can be confirmed in Outlook: open the message and its header from File menu → Properties).

In other words… you never get the info@my_domain.com address. How can this be done? UIPath replaces this address by the actual person’s “From.address” value, while not providing the on-behalf-to address (info@my_domain.com).

Two headers from Outlook e-mails.
screenHeaders|690x264

Let me try it and i ll get back you here. Anyway it looks more like a missing feature rather than a bug.

@Gabriel_Tatu Any update on this? I am getting same error while reading the from address of an email that too only for some email not for all the emails.

Formula used:
Sender Email = Mail.From.Address

Exception message:

Main has thrown an exception

Source: Read From Address

Message: Object reference not set to an instance of an object. This error usually occurs when using a variable with no set value (not initialized).

Exception Type: NullReferenceException

System.NullReferenceException: Object reference not set to an instance of an object.
at lambda_method(Closure , ActivityContext )
at Microsoft.VisualBasic.Activities.VisualBasicValue1.Execute(CodeActivityContext context) at System.Activities.CodeActivity1.InternalExecuteInResolutionContext(CodeActivityContext context)
at System.Activities.Runtime.ActivityExecutor.ExecuteInResolutionContext[T](ActivityInstance parentInstance, Activity1 expressionActivity) at System.Activities.InArgument1.TryPopulateValue(LocationEnvironment targetEnvironment, ActivityInstance activityInstance, ActivityExecutor executor)
at System.Activities.RuntimeArgument.TryPopulateValue(LocationEnvironment targetEnvironment, ActivityInstance targetActivityInstance, ActivityExecutor executor, Object argumentValueOverride, Location resultLocation, Boolean skipFastPath)
at System.Activities.ActivityInstance.InternalTryPopulateArgumentValueOrScheduleExpression(RuntimeArgument argument, Int32 nextArgumentIndex, ActivityExecutor executor, IDictionary2 argumentValueOverrides, Location resultLocation, Boolean isDynamicUpdate) at System.Activities.ActivityInstance.ResolveArguments(ActivityExecutor executor, IDictionary2 argumentValueOverrides, Location resultLocation, Int32 startIndex)
at System.Activities.Runtime.ActivityExecutor.ExecuteActivityWorkItem.ExecuteBody(ActivityExecutor executor, BookmarkManager bookmarkManager, Location resultLocation)

2 Likes

Hello,

can you share some of example which you are getting error for?
I tried and getting no errors.
did you updated the packages to the llatest release?

Thanks,
Meg

I have the same issue as Varshini

Moreover, some details:
I have a few workflows that use the UiPath.Core.Activities.ForEach <System.Net.Mail.MailMessage> and inside an Assign with
MailSender (that’s my variable name) = item.From.Address (that’s the command).

It has worked fine for quite some time. Today i had to email accounts from outlook and add them again because of some outlook issues. Since then, this Assign activity throws the error:

Message: Object reference not set to an instance of an object.

Interestingly, the error occurs not for all emails but only for some senders (but i cannot find a pattern when it won’t work and when it does).
Also, the command item.body works works fine for ANY sender (even those for whom item.from.address doesn’t work).

Again, very frustrating since it worked before (just yesterday) and now is only partially working and i have no clue why.

Please help.

Nobody any idea here? Anyone has the same problem?

I believe the problem might come with Microsoft Office 2016 Updates (32-Bit) from July (I am using Windows 10).
I think before the update, everything worked fine.

Hi @MW23

Is it possible for you to test it on another machine? It would give more clues as to what went broken.

Having the same problem here. It seems like the only property missing from my mailmessage objects are the Sender and From info. Everything else including headers and attachments are just fine.

BTW I’m grabbing mail by the get IBM mail activity from a 9.0.1 Notes client. When I use a custom activity to get locally saved mail into a Mailmessage object everything seems to work perfectly. And yes, the same piece of mail would trigger this error when grabbed directly from Notes and would do fine when grabbed locally.

I also experienced a null Mail.Sender or Mail.From. I tried running as administrator at both Outlook and UiPath, executed a few times and it’s working fine.

Will be sending more feedback after I tested enough.

After a few tests, it has something to do with the connectivity of Outlook and Exchange. Going offline would cause the value of Sender to be empty but the value of the Body can be captured by UiPath.

Not sure if running Administrator helps, but I didn’t experience any errors yet.

Found out that running as administrator doesn’t solve it, but I can say it has to do with connectivity of Outlook to Exchange.

Hi,

Any resolution on this?

I am trying to retrieve the sender’s mail id using “Mailitem.sender”. It was throwing Object reference error. Besides this, also i did observe that the issue occurs only with few senders. Not for every sender though.

Thanks…

Hi @SudhakarAs92

I would suggest you to debug your process and check the Locals panel to closely inspect the properties of the variable.

You should be able to find out what the issue is this way :slight_smile:

Hi @loginerror

I just checked and observed that Sender value comes as Null. Whereas rest of the values seems to be coming. Also I checked for other mail IDs for which the sender info is available. Any clue as to under what circumstances such things would occur? Thanks.

Capture

Is there something special about this particular email?

Office365 emails coming forwarded to Outlook with additional secure headers causing this issue of null for mail.from and mail.sender

Is that a known issue with latest package as i am on UiPath.Mail.Activities 1.1.6382.14550

Should i upgrade and try?

I thought i will inform how we resolved our issue. We just removed and added back the outlook email folder/dropbox account after the recent upgrade to office 365. Outlook sync occurred and the code was working back. Hope this shed some light on this to those having sync issues.