Skip to content

using emailjs with outlook smtp #44

Closed
manishkumarshr opened this Issue Aug 16, 2012 · 23 comments

10 participants

@manishkumarshr

Hi,

I was trying to use emailjs with outlook smtp but unable to use. I am writing my options object something like this:

var server = email.server.connect({
user: "my-use-mail-id",
password:"my-passwrod",
host: "smtp.outlook.com",
port: xyz,
ssl: true
});

when I do the same with gmail smtp, looks working great!! please give me a working example with outlook SMTP .

Thanks
-Manish

@eleith
Owner
eleith commented Aug 19, 2012

unfortunately, i don't have an outlook account with which to test this. googling around, i found a thread on MS 365 suggesting your server may not be named smtp.outlook.com but something else

from: http://community.office365.com/en-us/forums/158/t/57677.aspx

To find your server settings, sign in to your e-mail account using Outlook Web App. After you sign in, click Options > See All Options > Account > My Account > Settings for POP, IMAP, and SMTP access. The POP3, IMAP4, and SMTP server name and other settings you may need to enter are listed on the Protocol Settings page under POP setting or IMAP setting, and SMTP setting.

if indeed you are hitting an error, it would be helpful if you could provide more information on what error you are getting. that could give me some clues into where the error occurs.

@kumarmanish

{ code: 5,
message: 'connection encountered an error',
error: { [Error: connect ETIMEDOUT] code: 'ETIMEDOUT', errno: 'ETIMEDOUT', syscall: 'connect' } }

getting this error. :(

@eleith
Owner
eleith commented Oct 9, 2012

are you using this for a hotmail account? i might have access to a hotmail account i could use to test this? let me know, i could look into it if it was easy for me.

@kumarmanish

I am using company's internal email account that has smtp setup on outlook. i have my server setup somethign like this:

var server = email.server.connect({
user: "test@iicorporate.com",
password:"mypassword",
host: "smtp.outlook.com",
ssl: true

});

server.send({
text: "i hope this works",
from: "you test@iicorporate.com",
to: "someone test2@iicorporate.com",
subject: "testing emailjs.."
}, function(err, message) { console.log(err || message); });

@eleith
Owner
eleith commented Oct 9, 2012

i see. so this is not hotmail but some internal exchange server.

the error you reported normally happens when the settings are incorrect (bad domain or bad username or bad password or bad port).

if you can verify that all your settings are correct and work with other email clients (non microsoft ones), then i'll need more information to be able to fix the problem.

you could try debugging the problem and see where it fails (there is a debug param in emailjs that you can turn on to get the full SMTP output) and then report the stack trace to me.

otherwise, i don't know how else i can make progress on this one.

@kumarmanish

my email and SMTP settings are working just fine with the other nodejs packages like : " node_mailer " but not with this emailjs.

@eleith
Owner
eleith commented Oct 9, 2012

ok, good to know alternatives can work. it sounds i might not be handling an edge case for this particular server correctly. if you can get me a test account (or know how i can get one on some other system) that would help.

or if you can get a debug print out of the smtp commands that happen before the error happens, i could nail this one down.

if not, i understand.

@kumarmanish

Hey Eleith, I appreciate your quick responses and desire to help me out. I will certainly try to get you one account so that you can experience exactly what I am doing. for now I am using node_mailer and we will work out this emailjs issue for sure very soon.

thanks for your support,
Manish :)

@eleith
Owner
eleith commented Oct 10, 2012

sounds good. loooking forward to fixing this!

@gtracy
gtracy commented Feb 25, 2013

I'm seeing the same problem. The real problem for me is that it bring down my email interface permanently until I restart the server.

I'm try to add some more logging to get more details.

@xreader
xreader commented Mar 13, 2013

Hi, i need to use outlook.com smtp account too. Is't fixed now?

@eleith
Owner
eleith commented Mar 13, 2013

i'm a bit confused. i think the original reporter was talking about an outlook exchange server that they have access to. do the free email adddresses on outlook.com offer external SMTP?

i have a live.com account i could test with, so if someone can let me know what smtp address to use and what security settings (ssl, tls, port number) then i could test this one myself.

testing private outlook exchange servers is something i do not have access to.

@xreader
xreader commented Mar 13, 2013

One can use outlook.com email with own domain name

here are the settings (http://email.about.com/od/Outlook.com-Tips/qt/How-To-Access-Outlook-Com-Via-Pop-In-An-Email-Program.htm)

SMTP (outgoing mail) server: smtp.live.com
SMTP port: 587
As an alternative, you can try "25" as the SMTP port.
SMTP STARTTLS: yes
Try "SSL" or "SSL/TLS" if "STARTTLS" is not available.
SMTP authentication required: yes
SMTP user name: your entire Outlook.com email address (not an alias)
SMTP password: your Outlook.com password

@santimacia

Same problem,
Im using smtp.live.com (custom domain)
with ssl: true and tls:true
But I couldnt send anything yet.

@OlafurTorfi

I get code 5 error for connecting to gmail (se below) and timeout as above when connecting to an in-house smtp:

emailjs.server.connect({
host: "smtp.gmail.com",
user: user,
password: password,

ssl: true
});
Where user and password are my gmail account info...

Result:
{ [Error: connection encountered an error]
code: 5,
previous:
{ [Error: connect ECONNREFUSED]
code: 'ECONNREFUSED',
errno: 'ECONNREFUSED',
syscall: 'connect' },
smtp: undefined }

@tjunussovbee

Hi! I updated to latest emailjs but still have problems with connecting to smtp.office365.com

Here is some similar issues i think, it is called TLSUPGRADE
andris9/simplesmtp#25

Using this config
///////////////////////////////////
var server = email.server.connect({
user: "test@test.com",
password:"test",
host: "smtp.office365.com",
port : "587",
ssl: true,
tls: true
});

Got this error
/////////////////////////////////////
{ [Error: connection encountered an error]
code: 5,
previous:
[Error: 6052:error:140770FC:SSL routines:SSL23_GET_SERVER_HELLO:unknown proto
col:openssl\ssl\s23_clnt.c:683:
],
smtp: undefined }

Trying Telnet from my server to host
/////////////////////
telnet smtp.office365.com 587

220 AMXPR05CA003.outlook.office365.com Microsoft ESMTP MAIL Service ready at Wed, 26 Feb 2014 04:39:14 +0000

@tjunussovbee

It seems this issue happens->
Reason for the error is probably that you service only speaks SSLv3. Node HTTPS uses SSLv2 as default.

http://stackoverflow.com/questions/11091974/ssl-error-in-nodejs/12683325#comment25535766_12683325

@eleith
Owner
eleith commented Apr 7, 2014

thanks @tjunussov for the pointer.

i've updated the readme and the code with info on how to get this working

@eleith eleith closed this Apr 7, 2014
@eleith
Owner
eleith commented Apr 7, 2014

you'll need the latest master (it allows for customizing tls ciphers). i'll push out to npm by the end of the week

@manpreetgill

Same problem face
I get code 5 error for connecting to gmail (se below) and timeout as above when connecting to an in-house smtp:

emailjs.server.connect({
host: "smtp.gmail.com",
user: user,
password: password,

ssl: true
});
Where user and password are my gmail account info...

Result:
{ [Error: connection encountered an error]
code: 5,
previous:
{ [Error: connect ECONNREFUSED]
code: 'ECONNREFUSED',
errno: 'ECONNREFUSED',
syscall: 'connect' },
smtp: undefined }

@manpreetgill

solve that problem by stackoverflow
var email = require('emailjs');

var server = email.server.connect({
user: 'nodejsiscool@gmail.com',
password: 'stackoverflow',
host: 'smtp.gmail.com',
ssl: true
});

server.send({
text: 'Hey howdy',
from: 'NodeJS',
to: 'Wilson wilson.balderrama@gmail.com',
cc: '',
subject: 'Greetings'
}, function (err, message) {
console.log(err || message);
});
link://http://stackoverflow.com/questions/30598980/emailjs-not-working-node-js?answertab=active#tab-top

@junerockwell

Just a thought/suggestion; Have you all thought that maybe this error (listed below) is caused by a firewall from your end? If so, then this firewall is probably blocking the stmp.

{ [Error: connection encountered an error]
code: 5,
previous:
{ [Error: connect ECONNREFUSED]
code: 'ECONNREFUSED',
errno: 'ECONNREFUSED',
syscall: 'connect' },
smtp: undefined }

It's something worth considering if you haven't.

@manpreetgill

var https = require('https');
https.globalAgent.options.secureProtocol = 'SSLv3_method';
var email = require('emailjs');
var server = email.server.connect({
user: "name@yahoo.com",
password:"node@2015",
host: "smtp.mail.yahoo.com",
ssl: true
});
module.exports=server;
I am try to send emial by yahoo but cannot send email.
but this code is work in gamil.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.