Skip to content

Exemples de configurations SMTP de différents fournisseurs de mails

Auteur : Philippe Le Van - @plv@framapiaf.org

Date : 18 novembre 2024

Introduction

On utilise des prestataires externes pour envoyer des emails. Voici quelques configurations pour certains prestataires et certains logiciels.

Mailjet

Gitlab docker omnibus

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
services:
  web:
    #[...]
    environment:
      GITLAB_OMNIBUS_CONFIG: |
        gitlab_rails['smtp_enable'] = true
        gitlab_rails['smtp_address'] = 'in.mailjet.com'
        gitlab_rails['smtp_port'] = 80
        gitlab_rails['smtp_domain'] = 'in.mailjet.com'
        gitlab_rails['smtp_user_name'] = '**username**'
        gitlab_rails['smtp_password'] = '**password**'
        gitlab_rails['smtp_authentication'] = 'login'
        gitlab_rails['smtp_enable_starttls_auto'] = false
        gitlab_rails['gitlab_email_from'] = 'no-reply@example.com'
        gitlab_rails['gitlab_email_reply_to'] = 'reply-to@example.com'
#[...]

Symfony MAILER_DSN par l'API mailjet

Pour un accès via l'api mailjet en utilisant le bundle pour mailjet.

1
MAILER_DSN: "mailjet+api://**username**:**password**@default"

Symfony MAILER_DSN par SMTP mailjet

1
2
3
      APP_MAILER_URL: "smtp://**username**:**password**@in-v3.mailjet.com"
      APP_EMAIL_FROM: "toto@example.fr"
      APP_NOTIFICATION_EMAIL_FROM: "toto@example.fr"

Healthcheck (cronitoring)

dans le fichier .env

1
2
3
4
5
6
EMAIL_HOST=in-v3.mailjet.com
EMAIL_HOST_PASSWORD=**password**
EMAIL_HOST_USER=**username**
EMAIL_PORT=587
EMAIL_USE_TLS=True
EMAIL_USE_VERIFICATION=True

Nextcloud dans le fichier config.php

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
  'mail_from_address' => 'toto',
  'mail_smtpmode' => 'smtp',
  'mail_domain' => 'example.com',

  'mail_smtpauthtype' => 'LOGIN',
  'mail_smtpauth' => 1,
  'mail_smtphost' => 'in.mailjet.com',
  'mail_smtpport' => '587',
  'mail_smtpname' => '**username**',
  'mail_smtppassword' => '**password**',

Mattermost

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
    "EmailSettings": {
        "EnableSignUpWithEmail": true,
        "EnableSignInWithEmail": true,
        "EnableSignInWithUsername": true,
        "SendEmailNotifications": true,
        "UseChannelInEmailNotifications": false,
        "RequireEmailVerification": false,
        "FeedbackName": "Mattermost example",
        "FeedbackEmail": "webmaster@example.com",
        "ReplyToAddress": "webmaster@example.com",
        "FeedbackOrganization": "",
        "EnableSMTPAuth": true,
        "SMTPUsername": "**username**",
        "SMTPPassword": "**password**",
        "SMTPServer": "in-v3.mailjet.com",
        "SMTPPort": "465",
        "SMTPServerTimeout": 10,
        "ConnectionSecurity": "TLS",
        "SendPushNotifications": true,
        "PushNotificationServer": "https://push-test.mattermost.com",
        "PushNotificationContents": "full",
        "PushNotificationBuffer": 1000,
        "EnableEmailBatching": false,
        "EmailBatchingBufferSize": 256,
        "EmailBatchingInterval": 30,
        "EnablePreviewModeBanner": false,
        "SkipServerCertificateVerification": false,
        "EmailNotificationContentsType": "full",
        "LoginButtonColor": "#0000",
        "LoginButtonBorderColor": "#2389D7",
        "LoginButtonTextColor": "#2389D7"
    },

GANDI

Symfony MAILER_DSN Gandi par SMTP

1
MAILER_DSN: "smtp://toto@example.com:**password**@mail.gandi.net"