Error sending Outlook mail with Send SMTP mail message

Hello,

I’m using Send SMTP mail message to send Outlook emails as client cannot get Outlook app on their server. But I get the below error, wondering if anyone has a resolution?

I was able to resolve it in the past for a Gmail account by allowing less secure apps. But not sure how to handle it for Outlook account.

image (4)

I also tried Send Exchange Mail Message but got an error that “the underlying connection is closed”

Hi @6027ae06be5a67a04d29acc18 ,
this error is because of wrong port numbers.
Please check the port number you have provided.

Thanks & Regards,
Shubham Dutta

Hey @6027ae06be5a67a04d29acc18,

This looks like the DNS issue.
Can you share the screenshot of properties of the activity.

Thanks,
Sanjit

just try with smtp-mail.outlook.com
image

Unfortunately thag is not working.
Im now getting error “Send SMTP mail message. The operation has timed out”

In order to narrow down your issue and exclude the UiPath Studio cause, open a PowerShell console and check the below scripts. If they are working and you can send and receive the emails, that means some configuration in UiPath Studio is the issue. If not, double-check the SMTP server credentials.

With credentials, SSL, and an attachment:

$From = "USER.NAME@gmail.com"
$To = "USER.NAME@uipath.com"
$Cc = "USER.NAME@gmail.com"
$Attachment = "C:\Marian\policies.txt"
$Subject = "Email Subject"
$Body = "Insert body text here"
$SMTPServer = "YOUR_SMTP_SERVER_ADDRESS"
$SMTPPort = "YOUR_SMTP_PORT_NUMBER"
$username="YOUR_SMTP_USERNAME" 
$password = "YOUR_SMTP_PASSWORD" | ConvertTo-SecureString -AsPlainText -Force
$credential = New-Object System.Management.Automation.PSCredential($username, $password)
Send-MailMessage -From $From -to $To -Cc $Cc -Subject $Subject `
-Body $Body -SmtpServer $SMTPServer -port $SMTPPort -UseSsl `
-Credential $credential -Attachments $Attachment


Without credentials and SSL:

$From = "USER.NAME@gmail.com"
$To = "USER.NAME@uipath.com"
$Subject = "Email Subject"
$Body = "Insert body text here"
$SMTPServer = "YOUR_SMTP_SERVER_ADDRESS"
$SMTPPort = "YOUR_SMTP_PORT_NUMBER"
Send-MailMessage -From $From -to $To -Subject $Subject `
-Body $Body -SmtpServer $SMTPServer -port $SMTPPort

I used the second option but got this error that remote name could not be resolved: “smtp.office365.com

Does that mean the connection error is on the client’s side?

Does anyone have recommendation for another activity I could use pls?

Your company should have an internal SMTP server. I suggest using that.

1 Like

Try this to see if it working in the Studio machine in a cmd.exe console:

telnet smtp.office365.com 587

If it does not succeed, that means port 587 is blocked locally by a firewall/network.

Make sure port 587 is allowed outbound from this server in your firewall.

1 Like

Thanks everyone, issue was resolved by using the internal smtp, a different port nr and finally changed Authentication property of Send SMTP email to None.

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