Forum Discussion

TestQA1's avatar
TestQA1
Frequent Contributor
3 years ago

Sending email from gmail host

Hi,

 

I need to send email to my work account on completion of the test.

 

I found the sample method:

function Test()
{
  if (SendMail("ClareJ@clarejeffersoncorp.com", "mail.johnsmithcorp.com", "John Smith", "JohnS@johnsmithcorp.com", "Notification", "Hello Clare, Your application is nice.", "C:\\File1.txt", "C:\\File2.txt"))
    Log.Message("Mail was sent");
  else
    Log.Warning("Mail was not sent");
}

The method looks sufficient to send the alert that test has been completed, but when I setup as below:

function testmail()
{
if (SendMail("myname@officedomain.com", "smtp.gmail.com", "Gmail", "testing@gmail.com", "Notification", "Test Done!"))
Log.Message("Mail was sent");
else
Log.Warning("Mail was not sent");
}

Test complete executes else. Do I need to setup any pre-requisites. I have my officedomain (ToAddress) on Outlook desktop and I used web gmail for personal use. Also, if smtp.gmail.com is right hostname for gmail?

 

Thanks!