Esempio n. 1
0
function sendEmail(req, user, cb){
  var confirmationLink = req.headers.host +
    '/signup/confirm?u=' + user.confirmation.id +
    '&t=' + user.confirmation.token;

  if(secrets.env !== 'production'){
    confirmationLink = 'http://' + confirmationLink;
  } else {
    confirmationLink = 'https://' + confirmationLink;
  }

  var transporter = nodemailer.createTransport(
    mailgunApiTransport({
      apiKey: secrets.mailgun.api,
      domain: secrets.mailgun.domain
    })
  );

  var mailOptions = {
    to: user.email,
    from: secrets.mailgun.email,
    subject: 'Confirm your sign up for node-prelaunch.herokuapp.com',
    text: 'You are receiving this email because you (or someone else) has requested to be signed up for node-prelaunch.herokuapp.com.\n\n' +
      'Please click on the following link, or paste this into your browser to complete the process:\n\n' +
      confirmationLink + '\n\n' +
      "If you did not request this, feel free to ignore this email or delete it.\n"
  };

  if(secrets.env !== 'production'){
    console.log(confirmationLink);
    cb(null);
  } else {
    transporter.sendMail(mailOptions, cb);
  }
}
Esempio n. 2
0
var auth = {
  auth: {
    api_key: 'SMTP_PASSWORD',
    domain: 'MAIN_DOMAIN'
  }
}

config = {
    // ### Production
    // When running Ghost in the wild, use the production environment.
    // Configure your URL and mail settings here
    production: {
        url: 'http://MAIN_DOMAIN',
        mail: {
            from: 'SMTP_USER',
            transport: mailgunApiTransport(auth),
        },
        database: {
            client: 'sqlite3',
            connection: {
                filename: path.join(__dirname, '/content/data/ghost.db')
            },
            debug: false
        },

        server: {
            host: '127.0.0.1',
            port: '2368'
        }
    },