Forum Discussion

Ravikaanth0606's avatar
Ravikaanth0606
New Contributor
2 years ago

Failing to send an email through TestComplete

Hi team,

I trying to send a report through email but I am getting socket error. Please check the below code for your reference. Your ideas are appreciated. Thanks in advance.

 

Error:

JavaScript runtime error.

Socket Error # 10054
Connection reset by peer.

 

Code:

if(SendMail("receivermailid@squaredatalabs.com","smtp.hostinger.com","sendername","sendermailid@squaredatalabs.com","Test Report","Please find the attached report","file path"))

{
Log.Message("Mail was sent");
}

else
{
Log.Warning("Mail was not sent");
}

  • rraghvani's avatar
    rraghvani
    Champion Level 3

    Your email exchange system is rejecting the email. It's probably best to speak to your IT, to see if they can allow this.

  • rraghvani's avatar
    rraghvani
    Champion Level 3

    Is that the exact code you are using? The last parameter, you are passing in string called "file path"?

    • Ravikaanth0606's avatar
      Ravikaanth0606
      New Contributor

      Thanks for your reply,

      I am using my system file path. For example I mentioned like file path

      Actual path is - "E:\\MBTEST\\MBAutomation\\Report.html"

  • rraghvani's avatar
    rraghvani
    Champion Level 3

    Send an email without attaching a file, just to test whether your email exchange system allows it. Usually, email exchange systems are setup to stop third party software from sending emails.

    • Ravikaanth0606's avatar
      Ravikaanth0606
      New Contributor

      Yes tried without attaching a file I getting the same socket error

      Error:

      JavaScript runtime error.

      Socket Error # 10054
      Connection reset by peer.