Sending email using distribution list

Hello everyone,
for my process I have to send emails using exchange activities, as in the screenshot below.
In particular, the email address from which to send it (in red, property “EmailAutoDiscover” and “User”) is different from the one that must appear as the sender (in green, property “From”).

The address that must appear as the sender (in green) is a distribution list, so I get the following error, even though I can send emails using that sender.
immagine (3)

So can anyone tell me if with UiPath you can send emails using a distribution list as the sender?

Thanks all

A distribution list is not a valid emailbox / account, but an alias for multiple emails together.
So it is not possible to send ‘on behalf’ of a list. That would be like sending a mail on behalf of a 1000 persons.

Shared email accounts can work. Distribution lists simply no…

To use the custom name as sender, I would recommend using the SMTP mail activity.

By hand (without using UiPath) I can do it :slight_smile:

So using exchange activities is not possible?

It is possible the internal working of UiPath Exchange activity is having some issue with your requirement.
If you ok using Vb.NET code to send exchange email and it is allowed by your org, you can refer the below link
How to Send Email Messages using Exchange Server & Exchange Web Services Using C# & VB.NET
I have not tried the code but seems promising to me.
or just use SMTP to eliminate the hassle.

Using the code (in VB.NET) of the link, I get the following error:

error BC30002: Type 'IEWSClient' is not defined. At line 1
error BC30451: 'EWSClient' is not declared. It may be inaccessible due to its protection level. At line 1
error BC30311: Value of type 'String' cannot be converted to 'MailAddress'. At line 5
error BC30526: Property '[To]' is 'ReadOnly'. At line 6
error BC30311: Value of type 'String' cannot be converted to 'MailAddressCollection'. At line 6
error BC30456: 'HtmlBody' is not a member of 'MailMessage'. At line 8
 Variable 'IEWSClient' is missing. Please use Data Manager to recreate it.

check Vb.Net code from line 19 to 32

//[VB.NET Code Sample]

‘Create instance of ExchangeClient class by giving credentials
Dim client As ExchangeClient = New ExchangeClient("http://MachineName/exchange/username", "username", "password", "domain")

' Create instance of type MailMessage
Dim msg As MailMessage = New MailMessage()
msg.From = "sender@domain.com"
msg.To = "recipient@ domain.com "
msg.Subject = "Sending message from exchange server"
msg.HtmlBody = "  sending message from exchange server"

' Send the message
client.Send(msg)

Now the error is

error BC30002: Type 'ExchangeClient' is not defined. At line 1
error BC30002: Type 'ExchangeClient' is not defined. At line 1
error BC30311: Value of type 'String' cannot be converted to 'MailAddress'. At line 5
error BC30526: Property '[To]' is 'ReadOnly'. At line 6
error BC30311: Value of type 'String' cannot be converted to 'MailAddressCollection'. At line 6
error BC30456: 'HtmlBody' is not a member of 'MailMessage'. At line 8
 Type 'ExchangeClient' is missing. You probably need to add an Activity Package to your workflow.

Which package could i install?

1 Like

hey
After reading the description , I got to know that I missed to check the 3rd party package that they were referring to (its paid with free trial)

It got till this point:

Dim client As ExchangeService = New ExchangeService(ExchangeVersion.Exchange2007_SP1)
client.Url = New Uri("https://outlook.office365.com/ews/exchange.asmx")
client.Credentials = New WebCredentials("user", "pwd", "domain")
' Create instance of type MailMessage
Dim msg As EmailMessage = New EmailMessage(client)
msg.From = New EmailAddress("sender@domain.com")
msg.ToRecipients.Add("recipient@ domain.com ")
msg.Subject = "Sending message from exchange server"
msg.Body = "sending message from exchange server"
msg.Save
msg.Send

I cant test it as I do not have necessary resources.
I recommend sticking with SMTP to save all the hassle.

Thanks, maybe i use SMTP

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.