No description
| .env | ||
| .gitignore | ||
| package-lock.json | ||
| package.json | ||
| prova.txt | ||
| README.md | ||
| s1.js | ||
| s2.js | ||
Email server utilizzando IONOS email
utilizza account IONOS
é impostato sulla porta 3400
installa con
npm init -y
npm install body-parser dotenv express nodemailer
Server semplice
inserisci indirizzo soggetto e testo
avvia con
node s1.js
puoi testarlo con
curl -X POST http://192.168.1.3:3400/send-email \
-H "Content-Type: application/json" \
-d '{
"to": "fabio.micheluz@gmail.com",
"subject": "Test dal server Express",
"text": "Questa è una email di prova inviata via curl"
}'
Server completo
inserisci indirizzo soggetto testo html e allegati
tutti i parametri di configurazione sono nel file .env
avvialo con
node s2.js
esempio html con un pulsante che rimanda ad un link
curl -X POST http://192.168.1.3:3400/send-email \
-H "Content-Type: application/json" \
-d '{
"to": "fabio.micheluz@gmail.com",
"subject": "Email con testo, HTML e allegato",
"text": "Questa è la versione testuale della mail.",
"html": "<h1>Ciao Fabio!</h1><p>Questa è la versione HTML.</p><p><a href=\"https://google.com\" style=\"display:inline-block;padding:10px 20px;background:#007BFF;color:#fff;text-decoration:none;border-radius:5px;\">Esegui chiamata</a></p>",
"attachments": [
{
"filename": "prova.txt",
"path": "./prova.txt"
}
]
}'
come é fatto
├── body-parser@2.2.0
├── dotenv@17.2.3
├── express@5.1.0
└── nodemailer@7.0.10