Email management in ShipMySaaS

ShipMySaaS provides seamless integration with Resend, a modern and user-friendly email-sending platform. This integration simplifies the process of sending all types of emails, including transactional, promotional, and notification emails.

Resend integration

Resend offers a reliable and developer-friendly way to manage your email sending needs. With features like:

  • Ease of setup: Quickly connect your application to Resend.
  • Scalability: Handle high volumes of email traffic effortlessly.
  • Modern tooling: Enjoy support for advanced features like custom domains and analytics.

Email configuration

Here is an example of the email configuration in server.ts:

server.ts
const wabeApp = new Wabe<BackTypes>({
  email: {
    adapter:
      process.env.NODE_ENV === 'production'
        ? new ResendAdapter('YOUR_API_KEY')
        : new EmailDevAdapter(),
    mainEmail: '[email protected]',
    htmlTemplates: {
      sendOTPCode: () => 'your hmtl template',
    }
  },
  // Other options...
})

Note: Wabe use default template when sending emails for default operation like sendOTPCode, you can override it by passing your own template.

Built-in email templates

ShipMySaaS includes a pre-configured emails package that contains:

  • Ready-to-use templates: Email templates built using react-email, allowing you to send professional-looking emails without additional setup.
  • Custom templates: The ability to add your own email designs tailored to your application's needs.

Send emails

To send an email, simply call the send method on the email controller:

wabeApp.controllers.email?.send({
  from: "[email protected]",
  to: ["[email protected]"],
  subject: "subject",
  text: "text",
  html: "html",
  node : // React.ReactNode
})

Or with GraphQL mutation sendEmail:

mutation sendEmail {
  sendEmail(
    input: {from: "[email protected]", to: ["[email protected]"], subject: "subject", text: "text", html: "<html></html>"}
  )
}

Note: You should choose between text and html fields not both.

For more details, visit the Wabe email guide.