Cannot figure out how to send mails using emailjs. I also trying to send it from my domain address using yandex's "mail for domain" (lets assume my domain is called mydomain.com). "Mail for domain" has been set up exactly as instructed, and web interface works ok.
I made a file for testing purposes having:
var emailjs = require("emailjs/email");
var emailjsSettings = {
user: "noreply@mydomain.com",
password: "fancypassword",
host: "smtp.mydomain.com",
port: 465,
ssl: true
}
var ejsServer = emailjs.server.connect( emailjsSettings );
var data = {
text: 'message body',
from: 'noreply@mydomain.com',
to: 'someone@somemail.com',
subject: 'A subject'
}
ejsServer.send( data, function( error, message ) {
if( error )
console.log( '[!] send error:', error );
else
console.log( 'email send successfully.' );
});
Whatever settings I try I get the same error:
[!] send error: { [Error: timedout while connecting to smtp server] code: 4, smtp: undefined }
P.S. due to small reputation I cannot add emailjs tag to the message. Please someone add it. Thank you.
You should use 'smtp.yandex.ua' for host, not your domain.