How to accept receiver address from a MailAddress variable for Outlook

email
outlook

#1

Hi,

I am trying to read the sender’s address from Outlook in a variable (senderAdd) declared as System.Net.MailAddress.

This is fine.

Now I want to send back an email to the same id.

I do not know how to convert the value in senderAdd to appropriate type to be filled in the ‘To’ field of the Send Outlook Mail Message Activity.

The ToString does not work, for which I get the following error:

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

Does anybody know what to do?

Thanks and Regards,
Sarika


#2

Hi,
item.From.Address.ToString
Here we go.
replaymail.xaml (8.7 KB)


#3

Thanks Dilip. Appreciate your help!

I have declared senderAdd variable of the type MailAddress. it does not have a ‘From’ function.

What I am trying to do is that I save

senderAdd = mail.Sender
(where mail is a MailMessage variable).

Now I need to store the string equivalent of senderAdd into a string variable (receiverAdd) to be able to pass it to the Send Outlook Mail Message Activity.

I am using the uiPath GUI options only. i am not very well versant with .Net core programming, so don’t know how to modify directly as per the code snippet that you have pasted.

It throws an exception when i call

senderAdd.ToString

or

senderAdd.DisplayName

Thanks,
sarika


#4

mail.Sender doesn’t work.

You can’t declare like this. Do you mind attaching your workflow?


#5

Hi Dilip,

It worked!! Did some RnD plus your inpts!!

Thanks!!