Ask a Question

Can't able to send a file through email

Ravikaanth
Contributor

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, 

 

JavaScript runtime error.
Socket Error # 10054
Connection reset by peer.
5 REPLIES 5
rraghvani
Champion Level 2

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.

Marsha_R
Champion Level 2

You can also try sending it to an email outside your organization just to test the connection. 

@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.

 

Error message: "Must issue a STARTTLS command first. y12-20020a63fa0c000000b0051b36aee4f6sm2424658pgh.83 - gsmtp."

@rraghvani  Yes, I tried without an attachment. I am getting the same socket 10054 error.

rraghvani
Champion Level 2

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. 

cancel
Showing results for 
Search instead for 
Did you mean: