Send email using other people/machine's email account


We are trying to send emails using following scenario:

User 1’s email account is configured and logon information is provided, we want to send email from user 2’s account. (user 2’s email address is also provided).

But it fails, email still sent out using User 1’s account.

Can anyone help? This is related to our production process and it’s very urgent!!


I have always used one account as sender and configured their logon credentials, in case you want to send out emails as User2 account why don’t you set their logon credentials. You might get this error when you run the bot and I referred to this post for the error.

Thanks for your reply.

Right now user 2 is a group email account which we don’t have logon credentials (and our company won’t be able to provide this info), that’s why we want to fake the sender to be user 2 instead of user 1. If it is not possible to achieve it using SMTP email message, is there any other way we can achieve this?

Thank you!

You can write your own code using Invoke code activity. Just like in regular .NET programming to send email, I’ve invoked code directly for this purpose. Below mentioned is the code snippet:

Dim smtpClient As New System.Net.Mail.SmtpClient(in_MailServer)
Dim mailMsg As New System.Net.Mail.MailMessage
Dim sender As New System.Net.Mail.MailAddress(in_Sender)
mailmsg.Body = in_MailMsgBody
mailMsg.Subject = in_Subject
mailMsg.From = sender
mailMsg.IsBodyHtml = True
smtpClient.Port = Integer.Parse(in_MailPort)

Please mark it as solution, when it works for you.


We don’t have Invoke code activity, we are using Studio version 2016.2.6379 which doesn’t have this activity.
Is there any other solutions to achieve this?

Try translating above code into sequence (assign and invoke method).


Sending an email from a secondary mailbox is working for us only when we set following conditions:

Also if you want to send from an anonymous or group email address (User 2) you need to provide credentials of a primary mail account (User 1’s account). Hope this helps!!

smtpClient.UseDefaultCredentials = false;
smtpClient.Credentials = new System.Net.NetworkCredential("username", "password", "domain");

Thank you, it’s resolved.

Can you please explain how it worked? if you could provide a sample .xaml file that would be great.