20-06-24 10:26 AM
Team,
I have a scenario where bot has to reply to an email by removing original sender and should send to the different "TO" address. We don't have any action in Outlook v10.3.4 VBO so can someone help to achieve this?
Regards
20-06-24 11:42 AM
Hi @MohammedNissarK ,
In order to achieve this, best approach would be to create a duplicate action page for the current Reply Email action and you can name it as Reply To Email With Different Sender.
Now, add one input parameter called 'To' of text type:
Add this data item as an Input with the name 'Sender_To' in the code stage as well and write the following code:
Dim app = CreateObject("Outlook.Application")
Dim _nameSpace = app.GetNameSpace("MAPI")
Dim item = _nameSpace.GetItemFromID(Entry_ID)
Dim reply = item.Reply
reply.Subject = item.Subject
reply.HTMLBody = Message & vbCrLf & item.HTMLBody
reply.To = Sender_To
reply.Send
Publish the action and you should be able to test the same. In my case, I just added my email as To input parameter and you can see I got reply even though the original email was sent to someone else:
Original Message came from Twitter (now X) to my Microsoft email account (where Outlook is setup) and when I used Reply action, the new message got sent to my personal Gmail account from my Microsoft email account.