Ho configurato il file config.json contenente i parametro smtpOptions da passare a nodemailer per invio email dall'interno della web applicaions si una VPS.
Utilizzo una email su register.it
I parametri impostatai sono :
"host": "localhost",
"user": "utente",
"password": "passw1@..d",
"database":"miodb",
"port":3306,
"dialect": "mysql",
"underscored": 0,
"pool": {
"max": 5,
"min": 0,
"acquire": 30000,
"idle": 5000
},
"secret": " ",
"expiresIn": 86400,
"emailFrom": "ind.diposta",
"smtpOptions": {
"host": "authsmtp.securemail.pro",
"port": 465,
"auth": {
"user": "in.di postat",
"pass": "miapass@#.xf@@..#"
},
"tls": {
"rejectUnauthorized": false
},
"secure": true
}
}
se faccio nmap sulla rete mi da
Host is up (0.00040s latency).
Not shown: 996 filtered ports
PORT STATE SERVICE
22/tcp open ssh
80/tcp open http
443/tcp open https
465/tcp closed smtps
il firewall ufw risulta aperto nelle seguenti porte
nano status ufw verbose
To Action From
-- ------ ----
80/tcp ALLOW IN Anywhere
465/tcp ALLOW IN Anywhere
22/tcp ALLOW IN Anywhere
443/tcp ALLOW IN Anywhere
3000/tcp ALLOW IN Anywhere
25/tcp ALLOW IN Anywhere
3306/tcp ALLOW IN Anywhere
80,443/tcp (Nginx Full) ALLOW IN Anywhere
80/tcp (v6) ALLOW IN Anywhere (v6)
465/tcp (v6) ALLOW IN Anywhere (v6)
22/tcp (v6) ALLOW IN Anywhere (v6)
443/tcp (v6) ALLOW IN Anywhere (v6)
3000/tcp (v6) ALLOW IN Anywhere (v6)
25/tcp (v6) ALLOW IN Anywhere (v6)
3306/tcp (v6) ALLOW IN Anywhere (v6)
80,443/tcp (Nginx Full (v6)) ALLOW IN Anywhere (v6)
inviando email ricevo il seguente errore
SMTPConnection._formatError (/var/www/backend/html/node_modules/nodemailer/lib/smtp-connection/index.js:784:19)
at SMTPConnection._actionAUTHComplete (/var/www/backend/html/node_modules/nodemailer/lib/smtp-connection/index.js:1536:34)
at SMTPConnection.<anonymous> (/var/www/backend/html/node_modules/nodemailer/lib/smtp-connection/index.js:540:26)
at SMTPConnection._processResponse (/var/www/backend/html/node_modules/nodemailer/lib/smtp-connection/index.js:947:20)
at SMTPConnection._onData (/var/www/backend/html/node_modules/nodemailer/lib/smtp-connection/index.js:749:14)
at SMTPConnection._onSocketData (/var/www/backend/html/node_modules/nodemailer/lib/smtp-connection/index.js:189:44)
at TLSSocket.emit (node:events:518:28)
at addChunk (node:internal/streams/readable:561:12)
at readableAddChunkPushByteMode (node:internal/streams/readable:512:3)
at Readable.push (node:internal/streams/readable:392:5) {
code: 'EAUTH',
response: '535 5.7.0 ...authentication rejected',
responseCode: 535,
command: 'AUTH PLAIN'
con user e password inpostae in config.json, accedo alla webemail di Register.
I parametri mi sembrano corretti. Nessuno ha mai dovuto confrontarsi con invio posta con nodamailer ?
Grazie
Moreno