Reply to the same recipient from whom got a mail in the same thread

Hi all, I need to reply to the same recipient from whom got a mail in the same thread. But am using the below xaml , where am able to send the mail, but not to the same recipient.

replymail.xaml (8.6 KB)


When you have the mailMessage, extract the sender mailMessage.Sender.ToString
then when you are sending the mail, use that variable in the To

In your sendMail i see you have a string value and you are not using the variable reply_to

Hi @nadim.warsi, can you once explain your point describing above.


  1. you have GetMailMessages -> result List_mails

  2. You are looping through each mail in the list
    …2a. you get the sender: item.From.ToString or use item.Sender.ToString
    …2b. you get the subject: item.Subject.ToString
    …2c. you can get the body as well : item.Body.ToString [so that you can put your reply on top of it]

  3. Now when you sendSMTPMailMessage. your params are:

To: item.Sender.ToString
Subject: “RE:”+item.Subject.ToString
Body: “Hi,”& vbNewLine &-------------------------& vbNewLine & item.Body.ToString

So you loop replies to the mails.
Generally the SendMail does not allow same thread addition automatically like you do in Outlook/Gmail Reply option

Let me know if it helps

@nadim.warsi, you are saying that by using any Send mail activity, cannot automatically reply to the recipient!?

Automatically, the thread does not come below the same body, but when it is grouped in your mail box like gmail you can see them together

See similar threads:

Ok @nadim.warsi, Thankyou!

welcome :slight_smile:
let me know if the solution works well for you.

Ya @nadim.warsi, it worked for me.

1 Like


I did not recieve trail code in welcome email.

can you please help me how can i get it so that i can work on trail version


Hi @sagarsk

Welcome to our UiPath Forum! :slight_smile:

Please check with our support here:

This is normally a sign that someone from your domain has already requested it in the past and it expired.

Hello sushmithaelluru,

I am also doing the same task. I can send the reply to person but it shows as a new email.I want reply to be in the same thread like we see in Gmail.
Can you please guide me if you have solution for this.
Thank you.

Yeah Sure @Nayana11, please look into the below xaml file.

Mail Reply.xaml (10.5 KB)

Please look into it.


Thank you so much sushmithaelluru for quick reply.
But the problem is the reply does not get linked with previous/main email. in mailbox it should get linked with previous mail but it shows like separate email.

This is working!

1 Like

Hey @sushmithaelluru,

I am also looking for the same code in one of my project.
Can you please resend the code as I am getting below error even I have all the activities in place?


Thank you!
Happy Automation! :slight_smile:

Hey @NavneetPanpaliya, I have sent in the above conversation. Can you please look into it!


Hello @sushmithaelluru,

I downloaded code from your below post only but getting this error message after opening the xaml file even I have all the activities in place.

Error message after opening xaml file.

I am using UiPath version 2018.2.3 so either you have developed code in higher version which does not support my current UiPath version or please help me to resolve the issue.

Thank You,
Navneet :slight_smile:
Happy Automation!

Hey @sushmithaelluru,

I am able to resolve the error message by editing the xaml using notepad and deleted CurrentIndex="{x:Null}" in (2018.2.3 version)

Hello @Nayana11,

I am also looking for same use case.

Can you please let me know how did you resolve issue for lining email to previous email instead of creating separate email?

Navneet :slight_smile:
Happy Automation!

Hey @NavneetPanpaliya, sorry for late reply. Please look into the following xaml,

Mail Reply.xaml (10.5 KB)