Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

trying to send basic nodemailer email

I'm trying to insert some test code with hard-coded email data directly into my nodemailer server.js file to get started with a basic working example. See the "test code" section at the following url:

http://jsbin.com/sibubi/1/edit?html,js,console

Server.js loads without issue without the test code. However, an error occurs when the "test code" section is included. It complains about "unsupported configuration" and suggests a downgrade but I copied the test code from the nodemailer website. Any idea what the issue might be and how to fix? Here's the error:

http://jsbin.com/kehofe/1/edit

like image 397
random512 Avatar asked Apr 26 '26 17:04

random512


1 Answers

package.json

"nodemailer": "~1.4.0",
"nodemailer-smtp-transport":"~1.0.3"

install them

Your controller code

var nodemailer = require('nodemailer');
var smtpTransport = require('nodemailer-smtp-transport');

var transport = nodemailer.createTransport((smtpTransport({
  host: YOUR_HOST,
  secureConnection: false, // use SSL
  port: 587, // port for secure SMTP
  auth: {
    user: YOUR_USERNAME,
    pass: YOUR_PASSWORD
  }
})));

You need to change the SMTP configuration as mentioned above. And the rest is same as 0.7 version code.

like image 91
Vishnu Avatar answered Apr 28 '26 09:04

Vishnu



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!