Skip to content
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

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

Open
plantainrain opened this issue Apr 7, 2021 · 0 comments
Open

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

plantainrain opened this issue Apr 7, 2021 · 0 comments
Assignees

Comments

@plantainrain
Copy link

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

@abea abea self-assigned this Apr 7, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants