Skip to Content
avatar image
Former Member

SMTP Configuration for Gmail in Sap HANA

Hi all,

I am trying to send mail from Hana XSJS by configuring the SMTP and getting the following error.

error connection denied

PFB the SMTP Configuration and XSJS please let me know the error.

SMTP Configuration:


var smtpConnection = new $.net.SMTPConnection();
var mail = new $.net.Mail({
        sender: {address: "**********"},
        to: [{ address: "***********"}],
        subject: "XSJS Email Test",
        subjectEncoding: "UTF-8",
        parts: [ new $.net.Mail.Part({
        type: $.net.Mail.Part.TYPE_TEXT,
        text: "The body of the mail.",
        contentType: "text/html",       
        var returnValue = mail.send();
        var response = "MessageId = " + returnValue.messageId +
        ", final reply = " + returnValue.finalReply;
        $.response.status = 200;
	$.response.status = $.net.http.OK;
    	$.response.status = $.net.http.BAD_REQUEST;

Thanks in Advance

smtp-config.png (93.2 kB)
Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

1 Answer

  • Jan 04, 2018 at 01:28 PM

    Hi Mayank,

    Could you also share the Trust Store configuration named here as "gmail_new"?
    I suspect you haven't imported all the certificates required for TLS/SSL handshake with Google.

    I also see that you are using proxy configuration "proxy:8080". Does your HANA system sits behind such proxy? And it is configured to support outbound SMTP protocol? Usually SAP docs state that you need to use proxy and port 8080, but that's in case your HANA box is sitting inside SAP's LAN. Check that as well.


    Add comment
    10|10000 characters needed characters exceeded

    • Hi Mayank,

      I have recently tested the smtp example in Java on my acocunt and I can safely say it uses the email address for authentication. You may need to create an app password for your integration scenario if your google account is configured for 2-step-verification. Since this is a feature that is implemented on each google product, SCI doesn't know how to deal with this type of security mechanism. So Google provides other means to authenticate against SMTP. All you need to do is create the app password in Google and use it instead of your regular e-mail password. Your user id is still your e-mail and the app password name is used only to identify where you use that particular app password.