Quantcast
Channel: SCN : All Content - All Communities
Viewing all articles
Browse latest Browse all 3184

Using Gmail To Send Email in HANA XSJS

$
0
0

Hi Experts ,

 

I am trying to send mail from HANA using gmail's smtp settings but not able to figure it out.

I have gone through the following  blogs but could not find much help.

How to send email from sap hana xs server using javascript

SAP HANA SPS 09: New Developer Features; New Core XSJS APIs

https://scn.sap.com/thread/3738248

 

Following is the smtp server settings:

smtp-gmail.PNG

 

Below is the XSJS code

 

//create email from JS Object and send  
var mail = new $.net.Mail({      sender: {address: "*******@gmail.com"},      to: [{ address: "******@gmail.com"}],      subject: "XSJS Email Test",      parts: [ new $.net.Mail.Part({          type: $.net.Mail.Part.TYPE_TEXT,          text: "The body of the mail.",          contentType: "text/plain"      })]  
});  
var returnValue = mail.send();  
var response = "MessageId = " + returnValue.messageId + ", final reply = " + returnValue.finalReply;
$.response.setBody(response);

Usually i am getting the following error

 

Error: error coulnd't establish connection (line 12 position 1 in *******/SEND_MAIL.xsjs)

 

Am I missing any step or something wrongly configured?

 

It would  be great if somebody can help me on this.


Viewing all articles
Browse latest Browse all 3184

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>