Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiple Nodemailer transporters #135

Closed
ohbob opened this issue Dec 10, 2023 · 2 comments
Closed

Multiple Nodemailer transporters #135

ohbob opened this issue Dec 10, 2023 · 2 comments

Comments

@ohbob
Copy link

ohbob commented Dec 10, 2023

Feature request

Use multiple transporters

Summary

Quick summary what's this feature request about.
I would like to send emails from several domains, as my backend hosts several domains.

Why is it needed?

I want clients to receive emails from the domain that is associated with the project

Suggested solution(s)

I know i can manually send from several transporters but i have no idea on how to use it with your layouts.

const nodemailer = require('nodemailer');

// Transporter for the first identity
const transporter1 = nodemailer.createTransport({
    host: 'smtp.first-server.com',
    port: 587,
    secure: false, // true for 465, false for other ports
    auth: {
        user: '[email protected]',
        pass: 'password1'
    }
});

// Transporter for the second identity
const transporter2 = nodemailer.createTransport({
    host: 'smtp.second-server.com',
    port: 587,
    secure: false, // true for 465, false for other ports
    auth: {
        user: '[email protected]',
        pass: 'password2'
    }
});

// Example of sending an email with the first identity
transporter1.sendMail({
    from: '[email protected]',
    to: '[email protected]',
    subject: 'Email from first identity',
    text: 'This is the email content.'
}, (err, info) => {
    if (err) {
        console.error(err);
    } else {
        console.log('Email sent: ' + info.response);
    }
});

// Example of sending an email with the second identity
transporter2.sendMail({
    from: '[email protected]',
    to: '[email protected]',
    subject: 'Email from second identity',
    text: 'This is the email content.'
}, (err, info) => {
    if (err) {
        console.error(err);
    } else {
        console.log('Email sent: ' + info.response);
    }
}); 

A clear and concise description of what you want to happen.

Suggest a solution

Related issue(s)/PR(s)

Let us know if this is related to any issue/pull request.

Copy link

Thank you!! This is your first issue on this repo

@begservice
Copy link

i would like that feature 2, i think also we should make it strapi 5 ready.

Repository owner locked and limited conversation to collaborators Oct 17, 2024
@alexzaganelli alexzaganelli converted this issue into discussion #148 Oct 17, 2024

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants