Skip to Content
0

Error couldn't send EHLO header while sending emails through XSJS App

Feb 11 at 09:58 AM

95

avatar image
Former Member

Hello,

I am trying to send emails through my xsjs application, So I tried with Google & Office365. I have done the configuration for trust manager & SMTP configuration but for google its working & for office365 its not working.

Google >> SMTP worked & emails are getting forwarded to the recepient inbox.

Office365 >> SMTP not working & I am getting "Error couldn't send EHLO header".

SMTP Configuration

Office365 Trust Manager Configuration

Code to send email through XSJS

function SendEmail() {
var subscribers = ["emailaddress@google.com", "emailaddress@google.com"];
var smtpConnection = new $.net.SMTPConnection();
var mail = new $.net.Mail({ sender: "no-reply@emailaddress.in",
    subject: "Promotion Notice",
    subjectEncoding: "UTF-8",
    parts: [new $.net.Mail.Part({
                type: $.net.Mail.Part.TYPE_TEXT,
                contentType: "text/html",
                encoding: "UTF-8"
           })]
    });
var response = '';
for (var i = 0; i < subscribers.length; ++i) {
     mail.to = subscribers[i];
     mail.parts[0].text = "Dear " + subscribers[i].split("@")[0] + ", you have been promoted to expert developer. Congratulations!"
var returnValue;
     try {
		returnValue = smtpConnection.send(mail);
		$.response.contentType = "application/json";
		$.response.status = $.net.http.OK;
		$.response.setBody(JSON.stringify("MessageId = " + returnValue.messageId + ", final reply = " + returnValue.finalReply));
	} catch (err) {
		response = "Error occurred:" + err.message;
		$.response.contentType = "application/json";
		$.response.status = $.net.http.OK;
		$.response.setBody(JSON.stringify('Invalid Command ' + response));
	}
}
smtpConnection.close();
}
SendEmail();
untitled.png (71.8 kB)
untitled.png (71.8 kB)
untitled.png (51.5 kB)
10 |10000 characters needed characters left characters exceeded

I am also having the same issue.

Any Solution?

0

Hi I am also having same error I've changed all the possibilities

Can anyone help to resolve the issue

Thanks

Madan Kannan

0
* Please Login or Register to Answer, Follow or Comment.

0 Answers