Use multiple message configurations
masterYou can define multiple presets by providing an array to the message configuration. Each object in the array can have a name property. You can then trigger a specific configuration using the config key in the .send() method, either by its name or its index in the array.
// nuxt.config.ts
export default defineNuxtConfig({
modules: [
['nuxt-mail', {
message: [
{ name: 'contact', to: 'contact@foo.de' },
{ name: 'support', to: 'support@foo.de' },
],
// ... smtp config
}],
],
});
// Usage in component
mail.send({
config: 'support', // or config: 1
from: 'John Doe',
subject: 'Incredible',
text: 'This is an incredible test message',
});