cancel
Showing results for 
Search instead for 
Did you mean: 

Iam facing issue in sending auto email using javascript code,

ManjunathRajeev
New Contributor

Iam facing issue in sending auto email using javascript code,

Hi

 

When i execute below script , i'm not getting error it successfully executing the scripts "Mail sent successfully"

but iam not getting mail. Please help me with solution. Below is my script

Thank you in advance waiting for valuable solution

 

 

 


function SendEmail(mFrom,  mTo,  mSubject,  mBody,  mAttachment)
{
 
    var schema = "http://schemas.microsoft.com/cdo/configuration/";
    var mConfig = Sys.OleObject("CDO.Configuration");
    mConfig.Fields.Item(schema + "sendusing") == 2; // cdoSendUsingPort
    mConfig.Fields.Item(schema + "smtpserver") == "smtp.gmail.com";
    mConfig.Fields.Item(schema + "smtpserverport") == 25;
    mConfig.Fields.Item(schema + "smtpusessl") == true;
    mConfig.Fields.Item(schema + "smtpauthenticate") == 1;
    mConfig.Fields.Item(schema + "sendusername") == "senderusername";
    mConfig.Fields.Item(schema + "sendpassword") == "passwordtext";
    mConfig.Fields.Item(schema + "smtpconnectiontimeout") ==connectionTimeout;
    mConfig.Fields.Update();
    
    var mMessage = Sys.OleObject("CDO.Message");
    mMessage.Configuration = mConfig;
    mMessage.From = mFrom;
    mMessage.To = mTo;
    mMessage.Subject = mSubject;
    mMessage.HTMLBody = mBody;
    
    if(0 < mAttachment.length) {
      mMessage.AddAttachment(mAttachment);
    }
    
    mMessage.Send;
  Log.Message("Message to <" + mTo +  "> was successfully sent");
  return true;
}

function Test()
{
  SendEmail("sender@gmail.com", "receiver@gmail.com", "Test", "TestMessage", "");
}
 

4 REPLIES 4
Marsha_R
Community Hero

Re: Iam facing issue in sending auto email using javascript code,

ManjunathRajeev
New Contributor

Re: Iam facing issue in sending auto email using javascript code,

Hi Marsha,

 

I  tried below solution provided in link but still facing same issue. 

 

 

Issue is not resolved. Please let me know any change the i have to do in code

 

 

Marsha_R
Community Hero

Re: Iam facing issue in sending auto email using javascript code,

You can contact Support directly here:

https://support.smartbear.com/message/?prod=TestComplete

ManjunathRajeev
New Contributor

Re: Iam facing issue in sending auto email using javascript code,

Thank you for the link, i will update once issue got solved

New Here?
Join us and watch the welcome video:
Announcements
Top Kudoed Authors