In doc of this npm package: https://www.npmjs.com/package/express-mailer
Config must be in app.js file:
// project/app.js
var app = require('express')(),
mailer = require('express-mailer');
mailer.extend(app, {
from: 'no-reply@example.com',
host: 'smtp.gmail.com', // hostname
secureConnection: true, // use SSL
port: 465, // port for secure SMTP
transportMethod: 'SMTP', // default is SMTP. Accepts anything that nodemailer accepts
auth: {
user: 'gmail.user@gmail.com',
pass: 'userpass'
}
});
But I have this structure:
app_dir
config_dir
mail.js
app.js
And need to put this block in mail.js
It's possible to do that?
Thanks
Using js config (what you want)
// project/config_dir/mail.js
module.exports = {
from: 'no-reply@example.com',
host: 'smtp.gmail.com', // hostname
secureConnection: true, // use SSL
port: 465, // port for secure SMTP
transportMethod: 'SMTP', // default is SMTP. Accepts anything that nodemailer accepts
auth: {
user: 'gmail.user@gmail.com',
pass: 'userpass'
}
}
// project/app.js
var app = require('express')(),
mail_config = require('./config_dir/mail');
mailer = require('express-mailer');
mailer.extend(app, mail_config);
Using json config
// project/config_dir/mail.json
{
from: "no-reply@example.com",
host: "smtp.gmail.com",
secureConnection: true,
port: 465,
transportMethod: "SMTP",
auth: {
user: "gmail.user@gmail.com",
pass: "userpass"
}
}
// project/app.js
var app = require('express')(),
mail_config = require('./config_dir/mail.json');
mailer = require('express-mailer');
mailer.extend(app, mail_config);
Firebase Cloud Functions: PubSub, "res.on is not a function"
TypeError: Cannot read properties of undefined (reading 'createMessageComponentCollector')
My team is constantly adding json objects to a git repo that describe current projects they are working on/ have completedI developed a very simple api on a remote server that I can send these objects to, populate a list held in memory, and then make it possible...
I have a value of `1200000 mm' and I wan't to have a method which automatically transfers to the best prefix like:
Basically I'm trying to create a website that requires interfacing with the Discord API to retrieve user information to work