Send email using other people/machine's email account

email
activities

#1

Hi,

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!!

Thanks!
Fan


#2

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.


#3

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!


#4

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.To.Add(in_MailTo)
mailmsg.Body = in_MailMsgBody
mailMsg.Subject = in_Subject
mailMsg.From = sender
mailMsg.IsBodyHtml = True
smtpClient.Port = Integer.Parse(in_MailPort)
smtpClient.Send(mailMsg)

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


#5

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?


#6

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


#7

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");

#8

Thank you, it’s resolved.


#9

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