Skip to content
This repository was archived by the owner on Mar 29, 2025. It is now read-only.
This repository was archived by the owner on Mar 29, 2025. It is now read-only.

Improve "Sending email from your Apotrophe project" docs #350

Description

@plantainrain

The problem to solve

Not enough information/code examples in the docs for working barebones emails

Proposed solution

Adding code examples of possible configurations, along with links to supporting docs and npm modules

Example 1: using email service like Postmark with nodemailer's built in STMP transport options

'apostrophe-email': {
  nodemailer: {
    service: 'Postmark',
    auth: {
      user: 'username-from-postmark-account',
      pass: 'password-from-postmark-account'
    }
  }
};

Example 2: using email service like mailgun with supporting transport module

in apostrophe-email:

const mailgunTransport = require('nodemailer-mailgun-transport');
const nodemailer = require('nodemailer');
const _ = require('lodash');

module.exports = {
  construct: function (self, options) {
    self.getTransport = function (req, data, options) {
      const apiKey = 'your-mailgun-api-key';
      const domain = 'your-mailgun-domain';
      const auth = {
        auth: {
          api_key: apiKey,
          domain: domain
        }
      };
      const transport = mailgunTransport(_.assign(self.options.nodemailer, auth));
      self.transport = nodemailer.createTransport(transport);
      return self.transport;
    };
  }
};

Exmaple 3: set it up with credentials to send SMTP email via a gmail account (as suggested in docs)

Alternatives

N/A

Additional context

N/A

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions