Exception while invoking method 'createUser' Error: getaddrinfo ENOTFOUND

Hi guys. I am having issues Creating users on Meteor 1.3.5.0. In my server/mail.js I have this code

Meteor.startup(function() {
    process.env.MAIL_URL = "smtp://sender%40domain.com:pass%40example@smtp.example.com:465/";
    AccountsEntry.config({sendVerificationEmail: true});

    Accounts.emailTemplates.siteName = "Sender";
    Accounts.emailTemplates.from = "Sender<sender@example.com>";

    Accounts.emailTemplates.verifyEmail = {
        subject() {
            return "[SenderName] Verify Your Email Address";
        },
        text(user, url) {
            let emailAddress = user.emails[0].address,
                urlWithoutHash = url.replace('#/', ''),
                supportEmail = "sender@domain.com",
                emailBody = `To verify your email address
                  (${emailAddress}) visit the following link:\n\n${urlWithoutHash}\n\n
                  If you did not request this verification, please ignore this email.
                  If you feel something is wrong,
                  please contact our support team: ${supportEmail}.`;

            return emailBody;
        }
    };
});

my code to createUser in (client/signup.js) is :

Accounts.createUser({
    email: userData.email,
    password: userData.password,
    username: userData.username,
}, function (error) {
    if (error) {
      let errorDiv = $('#login-error.alert.alert-danger');
      errorDiv.html("Login Error: "+error.reason+"<br>Did you <a href='#'  data-toggle='modal' data-dismiss='modal' data-target='#forgotPasswordModal'>Forget Your password</a>? or Try another email address").show();
      setTimeout(function(){
         errorDiv.hide();
      }, 5000);
      toastr.error(
        "",
        "ERROR: " + error.reason
      );
      return false;
    } else {
        Meteor.call('createProfileField', Meteor.userId(), profile, function(error, response){
            if(error){
                toastr.error(error.reason, 'Error');
                return false;
            }else{
                $('#signupModal').modal('toggle');
                $('.modal-backdrop').hide();
                Roles.addUsersToRoles(Meteor.userId(), ['employee'])
                toastr.success("Your registration was successful, You are now logged in.");
                Router.go(currentPage)
            }
        });

    }
})

This creates the user but throws an error
Exception while invoking method ‘createUser’ Error: getaddrinfo ENOTFOUND

What seems to be the problem please? Thanks

That error typically means it can’t make a connection to an address. I suspect your email configuration may be incorrect. Could you possible test the configuration in an SMTP tool?

Hi @ashhimself, thanks for the response, i have. This has now been resolved on my local development environment.

But when I deploy to my digitalocean server, the same error comes up.


Exception while invoking method 'createUser' Error: getaddrinfo ENOTFOUND
    at Object.Future.wait (/bundle/bundle/programs/server/node_modules/fibers/future.js:449:15)
    at smtpSend (packages/email/email.js:89:1)
    at Object.Email.send (packages/email/email.js:192:1)
    at AccountsServer.Accounts.sendVerificationEmail (packages/accounts-password/password_server.js:797:9)
    at packages/accounts-password/password_server.js:1039:18
    at tryLoginMethod (packages/accounts-base/accounts_server.js:247:14)
    at AccountsServer.Ap._loginMethod (packages/accounts-base/accounts_server.js:380:5)
    at [object Object].createUser (packages/accounts-password/password_server.js:1015:19)
    at maybeAuditArgumentChecks (packages/ddp-server/livedata_server.js:1711:12)
    at packages/ddp-server/livedata_server.js:711:19
    - - - - -
    at errnoException (dns.js:37:11)
    at Object.onanswer [as oncomplete] (dns.js:126:16)

I am deploying with mup and I have run mup setup and then mup deploy

My code now looks like this

process.env.MAIL_URL='smtp://sender%40domain.com:' + encodeURIComponent("password") + '@smtp.example.com:465'

What I am suspecting is that while mup is setting up the env, it ignores, the new process.env.MAIL_URL.

Can I set up process.env.MAIL_URL in my settings.js file?