How to forward Outlook Email with some minor changes in HTML body

I need help in my current requirement where I need to forward an Outlook Email keeping HTML body template same and Adding a miner changes ( Also keeping HTML body unchanged, I need to Edit the Name in body.

Please suggest the solution

hi @Rameshwar_Rathod

=> Step 1: Get Outlook Mail Messages to retrieve the email you want to forward
Messages As List(Of MailMessage) = New List(Of MailMessage)()

Messages = Outlook.Mail.GetMailMessages(“your_mailbox@domain.com”, “Inbox”, “Unread”, DateTime.Now.AddMonths(-1), DateTime.Now)

Assuming you have retrieved the desired email and stored it in the “mail” variable

=> Step 2: Access the HTML body of the email
Dim htmlBody As String = mail.Body

=> Step 3: Make the necessary changes to the HTML body
For example, if you want to replace the placeholder “{Name}” with the actual name
newName As String = “John Doe”
htmlBody = htmlBody.Replace(“{Name}”, newName)

=> Step 4: Create a new MailMessage object to represent the forwarded email
forwardedMail As New MailMessage()

=> Step 5: Set the properties of the forwarded email
forwardedMail.Subject = mail.Subject
forwardedMail.Body = htmlBody
forwardedMail.IsBodyHtml = True ’ Set to True since it is an HTML body
forwardedMail.Sender = New MailAddress(“sender_email@domain.com”) ’ Set the sender email address

=> Step 6: Use the “Send Outlook Mail Message” activity to send the modified email
Outlook.Mail.SendEmail(“your_mailbox@domain.com”, forwardedMail)

Hope it helps!!

@mukeshkala @RAKESH_KUMAR_BEHERA @nisargkadam23 - I need to Edit the Name in body, Please suggest the solution.