2

I can't quite figure this out one... I have a SMTP server that's hosted on the same network as me, I can ping it and attempt to send emails, but the actual email never comes through. I'm using node_mailer... During the callback no error is returned... There is no authentication on the server as it's only used internally, and I'm not sure if that's maybe part of the problem. It works via ASP, but I'd like to get it working with Node.js

My script is basically just this:

email.send({
  host : "theaddressoftheserver(can ping)",
  port : "25",         
  domain : "theaddressoftheserver(can ping)",
  to : "Some@internalEmail.com",
  from : "Some@internalEmail.com",
  subject : "Test",
  body: "Test"
},
function(err, result){
  if(err) console.log(err);
  else console.log("Appears to have sent...");
});
A Wizard Did It
  • 3,614
  • 4
  • 28
  • 32
  • Have you checked what is going on on the wire? Wireshark etc… – b_erb Jan 05 '11 at 16:09
  • PartlyCloudy: I unfortunately don't have access to any of that... I just know that it works with ASP. That had me thinking that it was node_mailer, not the actual server. – A Wizard Did It Jan 05 '11 at 16:11

3 Answers3

0

I recently answered a similar question, it might help you:

https://stackoverflow.com/a/12623787/340736

Unfortunately, it's kind of hard to know exactly where your problem lies. Is the ASP-script on the same server? Have you tried running telnet against the server and sending it manually? Do the Node process have firewall restrictions?

One thing that comes to mind is that if you say that your ASP-script works, and that your SMTP-server uses no authentication. But could it be that is is, and that it is impersonating your user (the user in which the ASP-process is running under) and authenticating with that (AD authentication)..

Just a wild guess.

Community
  • 1
  • 1
Robin Orheden
  • 2,714
  • 23
  • 24
0

I would recommend you to use Postmark.

Postmark helps small and large web applications deliver and track transactional email. Stop worrying about setup, delivery, and server maintenance. We already excel at this.

There are already two Postmark libraries for Node.js.

Example

var postmark = require("postmark")("YOURAPIKEY");

postmark.send({
    "From": "donotreply@example.com", 
    "To": "target@example.us", 
    "Subject": "Test", 
    "TextBody": "Test Message"
});
Baggz
  • 17,207
  • 4
  • 37
  • 25
0

I figured node_mailer to send emails from a gmail account. I used code,

const transporter = createTransport({
  service: gmail,
  auth: {
    user: process.env.MAILADDRESS,
    pass: process.env.MAILPASSWORD
  }
});
let mailOptions = {
     from: process.env.MAILADDRESS,
     to: recipient@email.com,
     subject: 'verification code for verify email',
     text: 'verification code
   }

   transporter.sendMail(mailOptions, function(err, info){
    if (err) {
      // something

    } else {
      // something
    }
  })

This is simple. In order to make this work I had to make sure Gmail account's Less secure app access on before using that email. I'm talking about the email that I user to send email. (Sender's email).

So my point is if there is any security option in your SMTP server that's hosted on your same network, you need to turn it off in order to node_mailer to use email address.

Dinusha Naveen
  • 172
  • 1
  • 2
  • 14