Ask a Question

Can't able to send a file through email


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","","Ravikaanth N S","sender mail id","Test Report","Please find the attached report","E:\\MBTEST\\MBAutomation\\new.txt"))
Log.Message("Mail was sent");
Log.Warning("Mail was not sent");


Please find the below error for your reference, 


JavaScript runtime error.
Socket Error # 10054
Connection reset by peer.
Champion Level 3

Have a look at 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.

Champion Level 3

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("","","Ravikaanth","","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 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.

Champion Level 3

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. 

Showing results for 
Search instead for 
Did you mean: