如何使用 Mailjet 作为 Discourse 的免费 SMTP 服务

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 的问题,具体取决于您想做什么。

如果您想将 Mailjet 用作除 Discourse 使用的大规模电子邮件功能之外的个人电子邮件的 SMTP 服务器,它实际上并不支持:我可以使用 Mailjet 进行内部办公室电子邮件通信吗? 您需要设置另一个服务来发送和接收此类电子邮件(Google Workspace、Zoho Mail 等)。

1 个赞

@JammyDodger 我无法更新此内容,但其中一些屏幕截图和步骤已过时。

1 个赞

如果您有兴趣更新它,我可以将其设为 wiki 并将其移至指南部分?((:crossed_fingers:))

1 个赞

当然,我很乐意为您讲解并更新我能更新的内容,这可能需要几天时间。

2 个赞

@JammyDodger 我已更新 Discourse 设置部分。我尚未确认 DKIM 等设置,我也会看看我能对它们做些什么。

1 个赞

Namecheap 的屏幕截图

注意:
域名本身不应包含在主机(Host)字段中。这意味着,如果您需要为 something._domainkey.yourdomain.tld 添加记录,则只需要将 something._domainkey 添加为主机值(即使您的服务提供商要求您也添加域名本身)。这是系统要求。

1 个赞

谢谢!之后我该如何更改 SMTP 数据?本指南介绍了如何在 Discourse 的初始安装期间执行此操作。

并非专门针对 MailJet,但 Change SMTP settings in a working forum - #5 by slackmoehrle 包含详细信息。