Closed nimeyer22 closed 7 months ago
ah shit, i'll add a text field for you
@nimeyer22 was this resolved for you?
Sending email to: xxxx.xxxx@gmail.com
Error: Mail command failed: 550 5.7.0 From address is not one of your addresses
at SMTPConnection._formatError (/apps/api/node_modules/nodemailer/lib/smtp-connection/index.js:790:19)
at SMTPConnection._actionMAIL (/apps/api/node_modules/nodemailer/lib/smtp-connection/index.js:1594:34)
at SMTPConnection.<anonymous> (/apps/api/node_modules/nodemailer/lib/smtp-connection/index.js:1063:18)
at SMTPConnection._processResponse (/apps/api/node_modules/nodemailer/lib/smtp-connection/index.js:969:20)
at SMTPConnection._onData (/apps/api/node_modules/nodemailer/lib/smtp-connection/index.js:755:14)
at SMTPConnection._onSocketData (/apps/api/node_modules/nodemailer/lib/smtp-connection/index.js:193:44)
at TLSSocket.emit (node:events:514:28)
at addChunk (node:internal/streams/readable:545:12)
at readableAddChunkPushByteMode (node:internal/streams/readable:495:3)
at Readable.push (node:internal/streams/readable:375:5) {
code: 'EENVELOPE',
response: '550 5.7.0 From address is not one of your addresses',
responseCode: 550,
command: 'MAIL FROM
I'm getting an error when trying to send email notifications. I know these settings work because another application, (ghost CMS), that uses transactional emails are able to send them.
Reading through the nodemailer code for outgoing emails, it looks like the From address is hard-coded into the email templates.
We are setting a reply-to address in the SMTP settings, and it is included in the model for the email type. But it doesn't look like the code is retrieving and using this. I don't have any NodeJS experience, but I think the code would look something like this (using the Assigned Ticket email as an example):
export async function sendAssignedEmail(email: any) { try { let mail;
const emails = await prisma.email.findMany();
if (emails.length > 0) {
if (process.env.ENVIRONMENT === "development") {
let testAccount = await nodeMailer.createTestAccount();
mail = nodeMailer.createTransport({
port: 1025,
secure: false, // true for 465, false for other ports
auth: {
user: testAccount.user, // generated ethereal user
pass: testAccount.pass, // generated ethereal password
},
});
} else {
const email = emails[0];
const replyto = email.reply
mail = nodeMailer.createTransport({
// @ts-ignore
host: email.host,
port: email.port,
secure: email.secure, // true for 465, false for other ports
auth: {
user: email.user, // generated ethereal user
pass: email.pass, // generated ethereal password
},
});
}
console.log("Sending email to: ", email);
await mail
.sendMail({
from: replyto, // sender address
to: email, // list of receivers
...
This is now resolved @nimeyer22
Hello,
While trying to send out mails, I got the following message on the console:
The problem is that I can't change the "MAIL FROM" and my mail server doesn't allow this (noreply@peppermint.sh). How do you change this?