I wan to send mail with only nodemailer. With out other transport system.
below i have given my configuration.
I didn't received any mail, but response showing the mail is successfully send.
Username: sendbox#name.com
Password: ajsdkasd
Incoming Server: mail.name.com
IMAP Port: 993 POP3 Port: 995
Outgoing Server: mail.name.com
SMTP Port: 465
my node mailer configuration is
var Mailer = require("nodemailer");
var transportar = Mailer.createTransport({
service: "smtp",
host: "mail.name.com",
port: 465,
auth: {
user: "sendbox#name.com",
pass: "jsdkfjksd",
},
});
and
var mailOptions = {
from: "sendbox#name.com",
to: req.body.email,
subject: "Email Subjects",
html: "<h1>Welcome Reciver</h1>",
};
const sendEmail = await transportar.sendMail(mailOptions)
the response is
"email": {
"accepted": [
"name#gmail.com"
],
"rejected": [],
"envelopeTime": 36,
"messageTime": 4,
"messageSize": 311,
"response": "250 OK id=1jnlkk-0006FS-IO",
"envelope": {
"from": "sendbox#name.com",
"to": [
"name#gmail.com"
]
},
"messageId": "<cf7fbe92-c59a-9884-5061-77b95c3dcfba#name.com>"
},
Related
so I am using the Godaddy smtp relayer service and trying to send email using the nestjs-moudles/mailere library for this which implements actually the nodemailer. It works locally fine but when deploying to the server I am getting a timeout issue.
here is the node mailer config:
export const MAIL_CONFIG: MailerOptions = {
transport: {
host: 'relay-hosting.secureserver.net',
port: 25,
tls: { rejectUnauthorized: false },
enableSsl: false,
secure: false,
secureConnection: false,
auth: {
user: config.mailer.user,
pass: config.mailer.pass
}
},
defaults: {
from: config.mailer.from
},
template: {
dir: path.resolve(__dirname, '../../modules/secondary/mail/templates'),
adapter: new HandlebarsAdapter(),
options: {
strict: true
}
}
};
Anyone can help with this?
expect to be able to send emails.
In the console I can see:
Sending message <c188880-8889928-1149-89243441014#example.com> to <example#gmail.com>
This is how I'm configuring the transport:
nodemailer.createTransport({
name: "mail.example.com",
host: "mail.example.com",
port: 587,
secure: false,
auth: {
user: "reminders#example.com",
pass: PASSWORD, //
},
logger: true,
tls: {
rejectUnauthorized: false,
},
});
transporter.sendMail() function gives me this data:
{
accepted: [ 'example#gmail.com' ],
rejected: [],
envelopeTime: 2111,
messageTime: 842,
messageSize: 28925,
response: '250 OK id=198wlQ-exatqE-Lz',
envelope: {
from: 'reminders#example.com',
to: [ 'example#gmail.com' ]
},
messageId: '<ccddd9-8311-795e-00c1-7a43f27b6b70#example.com>'
}
It used to work, I don't know what's changed.
I've checked the spam/junk folders in the receiver's account.
Try this instead:
let transporter = nodemailer.createTransport(({
service: "Outlook365",
host: "smtp.office365.com",
port: "587",
tls: {
ciphers: "SSLv3",
rejectUnauthorized: false,
},
auth: {
user: "reminders#example.com",
pass: PASSWORD, //
}
}));
let info = {
from: 'reminders#example.com',
to: `${email}`,
subject: "Subject text",
html: `text`
};
transporter.sendMail(info, function (err) {
if (err) {
console.log(err);
} else {
res.json({ message: "Message sent" });
};
});
I'm building a Web-App using NodeJs. I'm stuck when I tried to connect the local server to metamask. When I try to add new network as mentioned in my. When I try to connect to localhost8545 in chrome extension then it returns this error:
trufle-config.js
var HDWalletProvider = require("truffle-hdwallet-provider");
module.exports = {
// See <https://truffleframework.com/docs/advanced/configuration>
// to customize your Truffle configuration!
networks: {
development: {
host: "127.0.0.1",
network_id: "*", // Match any network id
port: 8545,
//* gas: 8000000,
//* gasprice: 10000000000,
},
ropstenInfura: {
provider: function() {
return new HDWalletProvider(
process.env.INFURA_ROPSTEN_MNEMONIC,
"https://ropsten.infura.io/v3/" + process.env.INFURA_PROJECT_ID
);
},
network_id: "3",
},
ropstenLocal: {
from: "*********************",
host: "127.0.0.1",
port: 8545,
network_id: "*",
gas: 5000000,
gasPrice: 10000000000,
},
live: {
from: "*******************",
host: "127.0.0.1",
port: 8545,
network_id: "*",
gas: 500000,
gasPrice: 1000000000,
},
},
compilers: {
solc: {
version: "0.4.24",
},
},
};
Ganache-cli
I'm trying to send an ejs template with email-templates but I'm not having much joy.
The email sends fine, however it doesn't contain any template data.
const email = new Email ({
template: 'activateAccount',
message: {
from: "noreply#domain.com",
subject: "Activate your account!",
to: data.email
},
locals: {
name: data.name,
url: data.url
},
send: true,
transport: {
host: "domain.com",
port: 2525,
auth: {
user: "abc",
pass: "123"
}
},
views: {
options: {
extension: 'ejs'
}
}
});
return await email.send();
Does anyone know why the templates aren't being populated?
Use the locals when .sending the email,
const email = new Email({
message: {
from: "noreply#domain.com",
subject: "Activate your account!",
to: data.email
},
send: true,
transport: {
host: "domain.com",
port: 2525,
auth: {
user: "abc",
pass: "123"
}
},
views: {
options: {
extension: 'ejs'
}
}
});
await email.send({
template: 'activateAccount',
locals: {
name: data.name,
url: data.url
}
});
Basically, you can use all the options is .send function itself.
I have 2 interfaces, one mqtt and one for websocket. I noticed if I have a backend, the mqtt does not route to websocket.
I created the mosca server as below:
server = new mosca.Server(
{
interfaces:
[
{ type: "mqtt", port: 1883 },
{
type: "mqtts",
port: 8443,
credentials: { keyPath: SECURE_KEY, certPath: SECURE_CERT }
},
{ type: "http", port: 4000, bundle: true }
],
onQoS2publish: "noack",
logger: { name: 'MoscaServer', level: 'debug' },
backend: {
type: "mqtt",
json: false,
mqtt: require("mqtt"),
key: filesys.readFileSync(__dirname + "/certs/private.key"),
cert: filesys.readFileSync(__dirname + "/certs/cert.pem"),
ca: filesys.readFileSync(__dirname + "/certs/rootCA.cer"),
clientId: "randomClientId",
port: 8883,
host: "<aws IOT endpoint>.iot.<aws region>.amazonaws.com",
rejectUnauthorized: false,
protocol: "mqtts"
},
}
);
What do I need to do to route between all the 3: mqtt, websocket and the backend?
Thanks!