2

When I attempt to send an email via Wakanda Server, using the following code, an error occurs:

var mail = require('waf-mail/mail');
var message = new mail.Mail();
message.subject = "Here the subject of the email";
message.from = "me@mydomain.com";
message.to = 'user@somedomain.com';
message.setBody("This is a test message");

mail.send({
    address: 'mail.mydomain.com',
    port: 587,
    isSSL: true,
    username: 'MY-USERNAME',
    password: 'MY-PASSWORD',
    domain: 'mydomain.com'
}, message);

When running in debug mode, during mail.send the error occurs at the following line:

socket = tls.connect(port, address, connectCallback);

When debugging, I cannot step into this function call and the error occurs when attempting to do so.

The docs say that mail.send should return a status object, but that doesn't happen here. Adding a try/catch to the mail.send call produces this Error object in the catch:

Error = {
    error: [{
        componentSignature: "xbox"
        errCode: 5
        message: ""}],
    messages: [""]
}

Wakanda Server 1.1.3

MacOS 10.11.6

I am not using gmail to send the email.

Jeff G
  • 1,996
  • 1
  • 13
  • 22

1 Answers1

1

Make sure you have the correct address and port in the mail.send properties. you have to search the correct smtp settings for the mail you are using. for gmail i succed sending emails using the following :

var mail = require('waf-mail/mail'); 
var message = new mail.Mail();
message.subject = "Test";
message.from = "me@gmail.com";
message.to = ['me@gmail.com' , 'user@wakanda.io'];
message.setBody("This is a test message");
mail.send({
    address: 'smtp.gmail.com', 
    port: 465,
    isSSL: true,
    username: 'username', 
    password: 'password', 
    domain: 'gmail.com'
}, message);
issam Eljohri
  • 322
  • 1
  • 6
  • It turns out that the last character of the password was missing. Not sure how that happened. Even so, waf-mail should return the status object with an action property value of 3 (authentication failed) instead of throwing an incomprehensible exception. – Jeff G Mar 10 '17 at 14:10