After configuring email sender1

This commit is contained in:
Your Name 2026-11-01 20:02:00 +02:00
parent e68287affd
commit ad66af8e01
4 changed files with 48 additions and 6 deletions

View File

@ -120,7 +120,7 @@ SMTP_PORT=587
SMTP_SECURE=false SMTP_SECURE=false
SMTP_USER=admin@tloto.net SMTP_USER=admin@tloto.net
SMTP_PASS=your-admin-mailbox-password SMTP_PASS=your-admin-mailbox-password
EMAIL_FROM="Tloto" <info@tloto.net> EMAIL_FROM="Tloto <info@tloto.net>"
EMAIL_REPLY_TO=info@tloto.net EMAIL_REPLY_TO=info@tloto.net
VERIFY_EMAIL_PATH=/verify-email VERIFY_EMAIL_PATH=/verify-email
RESET_PASSWORD_PATH=/reset-password RESET_PASSWORD_PATH=/reset-password

View File

@ -79,7 +79,7 @@ PASSWORD_RESET_EXPIRY_HOURS=1
# SMTP_SECURE=false # SMTP_SECURE=false
# SMTP_USER=admin@tloto.net # SMTP_USER=admin@tloto.net
# SMTP_PASS=your-mailbox-password-or-app-password # SMTP_PASS=your-mailbox-password-or-app-password
# EMAIL_FROM="Tloto" <info@tloto.net> # EMAIL_FROM="Tloto <info@tloto.net>"
# EMAIL_REPLY_TO=info@tloto.net # EMAIL_REPLY_TO=info@tloto.net
# Candle Predict engine (performance tuning for production scale) # Candle Predict engine (performance tuning for production scale)

View File

@ -81,12 +81,22 @@ async function main(): Promise<void> {
main().catch((e) => { main().catch((e) => {
const msg = e instanceof Error ? e.message : String(e); const msg = e instanceof Error ? e.message : String(e);
console.error('SMTP verification failed:', msg); console.error('SMTP verification failed:', msg);
if (msg.includes('535') || msg.includes('BadCredentials') || msg.includes('Authentication unsuccessful')) { if (
msg.includes('SmtpClientAuthentication is disabled') ||
msg.includes('smtp_auth_disabled')
) {
console.error(
'\nMicrosoft 365 blocked SMTP AUTH for this tenant/mailbox.\n' +
' Enable Authenticated SMTP for admin@tloto.net (M365 admin → user → Mail → Email apps),\n' +
' or see https://aka.ms/smtp_auth_disabled — then retry verify-smtp.\n' +
' If MFA is on, use a Microsoft app password in SMTP_PASS.'
);
} else if (msg.includes('535') || msg.includes('BadCredentials') || msg.includes('Authentication unsuccessful')) {
console.error( console.error(
'\nAuth rejected. Tloto uses Microsoft 365 / GoDaddy only (not Gmail):\n' + '\nAuth rejected. Tloto uses Microsoft 365 / GoDaddy only (not Gmail):\n' +
' SMTP_HOST=smtp.office365.com SMTP_PORT=587 SMTP_SECURE=false\n' + ' SMTP_HOST=smtp.office365.com SMTP_PORT=587 SMTP_SECURE=false\n' +
' SMTP_USER=admin@tloto.net (mailbox password)\n' + ' SMTP_USER=admin@tloto.net (mailbox password or app password)\n' +
' EMAIL_FROM="Tloto" <info@tloto.net> (alias / Send As)\n' + ' EMAIL_FROM="Tloto <info@tloto.net>" (alias / Send As)\n' +
' EMAIL_REPLY_TO=info@tloto.net' ' EMAIL_REPLY_TO=info@tloto.net'
); );
} }

View File

@ -285,7 +285,7 @@ SMTP_PORT=587
SMTP_SECURE=false SMTP_SECURE=false
SMTP_USER=admin@tloto.net SMTP_USER=admin@tloto.net
SMTP_PASS=mot-de-passe-de-la-boite-admin SMTP_PASS=mot-de-passe-de-la-boite-admin
EMAIL_FROM="Tloto" <info@tloto.net> EMAIL_FROM="Tloto <info@tloto.net>"
EMAIL_REPLY_TO=info@tloto.net EMAIL_REPLY_TO=info@tloto.net
APP_PUBLIC_URL=https://tloto.net APP_PUBLIC_URL=https://tloto.net
RESET_PASSWORD_PATH=/reset-password RESET_PASSWORD_PATH=/reset-password
@ -309,6 +309,38 @@ Contrôler dans la boîte de réception : From = `info@tloto.net`, Reply-To = `i
Si erreur du type `SendAsDenied` / `550 5.7.60` : l’alias n’a pas le droit d’envoyer — corriger dans M365/GoDaddy avant de retenter. Si erreur du type `SendAsDenied` / `550 5.7.60` : l’alias n’a pas le droit d’envoyer — corriger dans M365/GoDaddy avant de retenter.
#### Erreur `535 5.7.139 … SmtpClientAuthentication is disabled for the Tenant`
La config Tloto est correcte (`EMAIL_FROM` / `SMTP_USER`), mais **Microsoft 365 bloque SMTP AUTH** sur le tenant (souvent désactivé par défaut).
Activer SMTP AUTH (une des voies) :
1. **Pour la boîte `admin@tloto.net` (recommandé)**
- [Microsoft 365 admin center](https://admin.microsoft.com) → **Users** → **Active users** → `admin@tloto.net`
- **Mail** → **Manage email apps** / **Email apps**
- Cocher **Authenticated SMTP** → Save
Ou PowerShell Exchange Online :
```powershell
Set-CASMailbox -Identity admin@tloto.net -SmtpClientAuthenticationDisabled $false
```
2. **Au niveau organisation** (si la case boîte est grisée)
- Admin center → **Settings** → **Org settings** → **Modern authentication** / **Mail**
- Ou : [https://aka.ms/smtp_auth_disabled](https://aka.ms/smtp_auth_disabled)
- Autoriser SMTP AUTH pour le tenant, puis réactiver sur la boîte.
3. Chez **GoDaddy** : Email & Office → Admin / Microsoft 365 → gérer l’utilisateur `admin@` → options de messagerie / SMTP authentifié (libellés varient).
Attendre 1–15 minutes, puis :
```bash
sudo npm run phase-b:verify-smtp
sudo docker compose run --rm --no-deps -e SMTP_TEST_TO=votre@email.com backend node dist/scripts/verifySmtp.js
```
Si MFA est obligatoire sur le compte : créer un **mot de passe d’application** Microsoft et le mettre dans `SMTP_PASS` (pas le mot de passe de connexion web).
> **Tloto n’utilise plus Gmail** comme expéditeur. Uniquement Microsoft 365 (`admin@` / alias `info@`). > **Tloto n’utilise plus Gmail** comme expéditeur. Uniquement Microsoft 365 (`admin@` / alias `info@`).
> **Ne pas committer `.env`** — il est ignoré par Git. > **Ne pas committer `.env`** — il est ignoré par Git.