Discourseの無料SMTPサービスとしてMailjetを使用する方法

In this small tutorial I will show you howto use mailjet as a free SMTP service for Discourse.

At the moment mailjet let you send 6000 mails per month or 200 per day for free and without sharing your credit card information.

Signup
You can sign up here Mailjet - Sign up (not a affiliate link)

Then validate your account by clicking the link in the email.

Create your domain
Go to your account settings: Mailjet

Press “Add a Sender Domain or Address”
Skærmbillede 2021-10-17 kl. 10.17.32

Then add your domain
(Please note that to validate a domain, you need to have access to your website hosting or your domain registration account.)

Adding a new domain

DNS verify your domain
Login to your DNS host.

Add a new DNS record based on the info from mailjet

Add the new TXT DNS record to you DNS service. In this case cloudflare.

End the validation by returning to your mailjet window. And press Check Now

You’ll see a window like this when you’re done
Skærmbillede 2021-10-17 kl. 10.29.05

Setup SPF Authentication
Under Mailjet “Sender & Domain” you find this option
Skærmbillede 2021-10-17 kl. 10.31.21

Make a new TXT DNS record with the recommended settings:

After this you should get a green setting window

Skærmbillede 2021-10-17 kl. 10.37.32

Set up DomainKeys/DKIM

Make a new TXT DNS record
Please make sure it stays on one line!

Setup Your Username and Password
First you need to generate your secret key, this will eventually be your SMTP Password. To do this go to API Key Management page.

On this page you see that your API Key (this will be your SMTP username) is created but partially redacted, but your Secret key needs to be generated:

Click the Generate Secret Key button. This will give you a new modal screen which contains your API Key and Secret Key. Copy these into a safe place as you’ll need them in the next step. If you lose your Secret Key you’ll need to regenerate it and setup Discourse SMTP again.

With that generated you can now visit the MailJet SMTP and SEND API Settings page to grab the rest of the settings you’ll need.

Installation of Discourse.
In the initial setup of discourse, use the following settings:

  • SMTP Server Address = MailJet SMTP server
  • SMTP Port = SMTP port it will be 25 or 587, note that some providers block port 25.
  • SMTP Username = MailJet API Key you copied.
  • SMTP Password = MailJet Secret key you copied.

Your setup will look similar to this:

Skærmbillede 2021-10-17 kl. 13.04.04

Then you should be done and ready to use the service. :partying_face: :partying_face: :partying_face:

「いいね!」 8

MailJetでアカウントを設定し、テストしています。

Discourseで新しいユーザーがアカウントを登録すると、noreply@XXX.comからアクティベーションメールが届きます。これは正常に機能します。

しかし、ユーザーが私(管理者)admin@XXX.comにメールを送信しようとすると、バウンスバックします。

554 5.7.1 admin@XXX.com: Relay access denied

これを修正するにはどうすればよいですか?

やりたいことによっては、これはDiscourseの問題ではない可能性が高いです。

Discourseが使用する一括メール機能に加えて、個別のメールのSMTPサーバーとしてMailjetを使用しようとしている場合、それは実際にはサポートされていません。Can I use Mailjet for my internal office email communications? このようなメールを送受信するには、別のサービス(Google Workspace、Zoho Mailなど)を設定する必要があります。

「いいね!」 1

@JammyDodger これを更新できませんが、スクリーンショットと手順の一部が古くなっています。

「いいね!」 1

もし更新にご興味があれば、ウィキにしてガイドセクションに移動させることができますよ?(:crossed_fingers:

「いいね!」 1

はい、喜んでご説明し、可能な限り更新させていただきます。数日かかるかもしれません。

「いいね!」 2

@JammyDodger Discourseの設定部分を更新しました。DKIMなどの設定はまだ確認していませんが、そちらについてもできることを確認します。

「いいね!」 1

Namecheap のスクリーンショット

注:
ドメイン名自体は、ホストフィールドに含めるべきではありません。これは、_domainkey.yourdomain.tld のようなレコードを追加する必要がある場合、サービスプロバイダーがドメイン自体も追加するように求めたとしても、ホストの値として something._domainkey のみを追加する必要があることを意味します。これはシステム要件です。

「いいね!」 1

ありがとうございます!後でSMTPデータを変更するにはどうすればよいですか?このガイドでは、Discourseの初期インストール中にこれを行う方法について説明します。

MailJetに特化したものではありませんが、Change SMTP settings in a working forum - #5 by slackmoehrle に詳細があります。