No description
Find a file
2025-12-07 16:57:53 +01:00
.env first commit 2025-12-07 16:57:53 +01:00
.gitignore first commit 2025-12-07 16:57:53 +01:00
package-lock.json first commit 2025-12-07 16:57:53 +01:00
package.json first commit 2025-12-07 16:57:53 +01:00
prova.txt first commit 2025-12-07 16:57:53 +01:00
README.md first commit 2025-12-07 16:57:53 +01:00
s1.js first commit 2025-12-07 16:57:53 +01:00
s2.js first commit 2025-12-07 16:57:53 +01:00

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