Mail Package
Mail Drivers
LaraNode supports multiple mail drivers.
Mail Drivers
LaraNode supports multiple mail drivers.
SMTP Driver
Send emails via SMTP server:
MAIL_DRIVER=smtp
MAIL_HOST=smtp.mailtrap.io
MAIL_PORT=2525
MAIL_USERNAME=username
MAIL_PASSWORD=password
[email protected]
MAIL_FROM_NAME="LaraNode App"
Log Driver
Write emails to log (for development):
MAIL_DRIVER=log
Array Driver
Store emails in memory (for testing):
MAIL_DRIVER=array
Failover Driver
Try multiple mailers in order:
// config/mail.config.ts
export default {
driver: "failover",
failover: {
mailers: ["smtp", "log"],
},
};
Switching Drivers
import { MailManager } from "@lara-node/mail";
const manager = new MailManager();
// Use specific mailer
manager.mailer("smtp").send(mailable);
manager.mailer("log").send(mailable);
Next Steps
- Mailables -- Building emails
- Queued Mail -- Queue emails
- Mail Overview -- Mail overview