Can't able to send a file through email
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Can't able to send a file through email
Hi team,
I am trying to send a file through an email, but I am getting an socket error. Please help me to resolve this issue. Thanks in advance.
Please find the below code for your reference,
if(BuiltIn.SendMail("receiver mail id","smtp.hostinger.com","Ravikaanth N S","sender mail id","Test Report","Please find the attached report","E:\\MBTEST\\MBAutomation\\new.txt"))
{
Log.Message("Mail was sent");
}
else
{
Log.Warning("Mail was not sent");
}
Please find the below error for your reference,
Socket Error # 10054
Connection reset by peer.
- Labels:
-
Script Tests
-
Test Run
-
Web Testing
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Have a look at https://bobcares.com/blog/ftp-socket-error-10054/ for possible solutions. Try sending an email without an attachment, does it work?
Note, your Email Server could be rejecting the email - you will need to consult with your IT.
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You can also try sending it to an email outside your organization just to test the connection.
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
@Marsha_R Yes, I tried with my Gmail id, Please check the below code,
if(BuiltIn.SendMail("ravikaanth2911@gmail.com","smtp.gmail.com","Ravikaanth","ravikaanth0606@gmail.com","Test Report","Please find the attached report","E:\\MBTEST\\MBAutomation\\new.txt"))
Also I tried without attaching the file, It shows below error
Unable to send email to the smtp.gmail.com server.
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
@rraghvani Yes, I tried without an attachment. I am getting the same socket 10054 error.
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I don't think Gmail will allow you to send unauthenticated third party emails via their servers called open mail relay.
If you are connected to your network organisation, you might be able to send a third party email using your current credentials.
