Skip to Content
0
Jan 04, 2018 at 11:11 AM

SMTP Configuration for Gmail in Sap HANA

1625 Views Last edit Jan 04, 2018 at 11:13 AM 2 rev

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:

XSJS Code

var smtpConnection = new $.net.SMTPConnection();
try{
var mail = new $.net.Mail({
        sender: {address: "**********@gmail.com"},
        to: [{ address: "***********@gmail.com"}],
        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",       
        encoding:"UTF-8"
        })]
        });
        var returnValue = mail.send();
        var response = "MessageId = " + returnValue.messageId +
        ", final reply = " + returnValue.finalReply;
        $.response.status = 200;
	$.response.status = $.net.http.OK;
	$.response.setBody(response);        
}catch(err){
    	$.response.status = $.net.http.BAD_REQUEST;
		$.response.setBody(err.message);
}

Thanks in Advance

Attachments

smtp-config.png (93.2 kB)