Has anyone try storing system.net.mail.mailmessage objects to datatable? and then send replies by looping from the datatable?

Hi i’m building automation that looks into multiple email requests that have multiple attachments, perform the automation based on the content of the attachment. when completed i dont really have any id that can reliably reference back to that email to send the reply. so i thought of creating a mapping table. so far hasn’t been successful. any ideas?


Write row(0).ToString and then try.

Welcome to uipath community
Instead of FOR EACH ROW we can directly mention the Reply to outlook mail message activity inside the precious FOR EACH loop as a Alastair’s activity where we can mention the Mail input as mail and body as Complete

We can do one thing
While creating datatable itself we need to create the first column with datatype System.Net.Mail.Mailmessage so that we won’t face this issue at all

Cheers @Jason_Yao

HI Lakshman, thanks for the reply, but row(0) is mailmessage object, i wouldn’t want to convert it tostring…

thanks for the reply, i’ve tried using regular for each loop, but it doesn’t work on datatables apparently. also datatype is system.net.mail.mailmessage object. i’m going to try storing those mail object in collections, hopefully that’ll work…

Email messages does have ids, see example here, but still would be no problem having a MailMessage column type and work with it the same ways you do with any other types…

1 Like

this is interesting! i had a feeling there could be an unique id for each messages somewhere, i just didn’t know how to find it. so how would uipath use that id to reply message?

I was hoping you would tackle this and share the results with us :grinning:

:joy: if i figure this out i’ll be sure to share with ya’ll

1 Like


The best Way to Tackle this issue is Storing the Message ID in the datatable using mail.headers(0).string.
Create a Dictionary with Dictionary(System.string,System.net.mail.mailmessage)
Keeping the string Key value as mail.header(0).tostring and the mail as it’s value.
While replying to the mail message use Dictionary(Datatable.rows.(rownum)(colnum).tostring to get the mail message from the dictionary.

1 Like