mailing setup for mailx, SMTPMailer.php, and nodemailer

Jul 1, 12:18 PM

generate a “special” password here: https://myaccount.google.com/u/2/apppasswords?rapt=AEjHLxxxxxx

“special” password is used for mailx (mail.rc) and SMTPMailer.php

node uses oath2 keys

############
  1. #
  2. mailx #
  3. #
    ##########

mailx – uses /etc/mail.rc uses password generated in the step above.

EXAMPLE:
echo `date` | /usr/bin/mailx -A gmailSMTP-noreply -s “test subject TEST” mark@edwardsmark.com ;

/etc/mail.rc:

account gmailSMTP-noreply { set smtp-use-starttls set ssl-verify=ignore set smtp-auth=login set smtp=smtp://smtp.gmail.com:587 set smtp-auth-user=noreply@comptonpeslonline.com set smtp-auth-password=gXXXXv set ssl-verify=ignore set nss-config-dir=/home/comptonpeslonline.com/gmailCerts/
}

###########
  1. #
  2. php #
  3. #
    ##########

SMTPMailer.php:

define (‘DEFAULT_EMAIL’ , ‘noreply@comptonpeslonline.com’ );
define (‘PORT25TEST’ , ‘check-auth-edwardsmarkf=gmail.com@verifier.port25.com’ );

define (‘DEFAULT_SMTP_HOST’ , ‘smtp.gmail.com’ ); // 2016-12-05
define (‘DEFAULT_SMTP_LOGIN’ , ‘noreply@comptonpeslonline.com’ ); // 2016-12-05
define (‘DEFAULT_SMTP_PASSWD’ , ‘gXXXXXXXv’ );

###########
  1. #
  2. node #
  3. #
    ###########

node uses an “auth0” approach:

const nodemailer = require(‘nodemailer’) ;

const authEmailAddy = ‘noreply@comptonpeslonline.com’ ;
const clientId = ‘6884XXXXXXh6n.apps.googleusercontent.com’ ;
const clientSecret = ‘SXXXXXXS’ ;
const refreshToken = ’1//0XXXXCq4’ ;

var auth = { type : ‘oauth2’ , user : authEmailAddy , clientId , clientSecret , refreshToken };

var transporter = nodemailer.createTransport( { service : ‘gmail’ , auth }
);

node example: /home/comptonpeslonline.com/public_html/comptonPractice/homeworkAssignment/ticklerMailer/ticklerMailer.js

Mark Edwards

,

---

Commenting is closed for this article.

---