analytics icon indicating copy to clipboard operation
analytics copied to clipboard

Bamboo.Mua configuration fix for some mailing servers

Open Striffly opened this issue 1 year ago • 8 comments

Past Issues Searched

  • [X] I have searched open and closed issues to make sure that the bug has not yet been reported

Issue is a Bug Report

  • [X] This is a bug report and not a feature request, nor asking for self-hosted support

Using official Plausible Cloud hosting or self-hosting?

Self-hosting

Describe the bug

Hello,

I recently migrated Plausible from version 2.0.0 to 2.1.0 (and now 2.1.1), and thus switched to Bamboo.Mua.

Since then, I have been encountering problems with receiving Plausible emails, which have become impossible.

To debug the issue, here are the commands I executed:

email = Bamboo.Email.new_email(from: PlausibleWeb.Email.mailer_email_from(), to: "[email protected]", subject: "test html_body", html_body: "test html_body")
Plausible.Mailer.deliver_now(email)

email = Bamboo.Email.new_email(from: PlausibleWeb.Email.mailer_email_from(), to: "[email protected]", subject: "test text_body", text_body: "test text_body")
Plausible.Mailer.deliver_now(email)

email = Bamboo.Email.new_email(from: PlausibleWeb.Email.mailer_email_from(), to: "[email protected]", subject: "test text_body html_body", text_body: "test text_body html_body", html_body: "test text_body html_body")
Plausible.Mailer.deliver_now(email)

To be sure of my results, I performed these commands each time with two different destination emails. In all cases :

  • The logs returned by the console do not indicate any errors and return a table of this type :
{:ok,
 %Bamboo.Email{
   from: {"xxx", "[email protected]"},
   to: [nil: "[email protected]"],
   cc: [],
   bcc: [],
   subject: "test text_body html_body",            <==== depending of command
   html_body: "test text_body html_body",       <==== depending of command
   text_body: "test text_body html_body",        <==== depending of command
   headers: %{},
   attachments: [],
   assigns: %{},
   private: %{},
   blocked: false
 }}

  • Only emails sent with both the text_body and html_body parameters (and not just one or the other) are correctly delivered. I deduce that on the Plausible side, one of the two parameters is not defined at the time of sending.

I discussed this issue on this link: https://github.com/plausible/analytics/discussions/4125#discussioncomment-9572216 However, I do not have the technical skills to correctly modify and debug the file https://github.com/plausible/analytics/blob/v2.1.0/lib/plausible_web/email.ex

As a mail server, I am using the SMTP from OVHcloud (https://www.ovhcloud.com/), which is the leading French hosting solutions provider. Therefore, a significant player in the web ecosystem.

Would it be possible to make this modification?

Expected behavior

Receive emails

Screenshots

No response

Environment

- OS: Debian 12
- Plausible environment: Docker
- Browser: Chromium
- Browser Version: 126.0.6478.61

Striffly avatar Jun 19 '24 20:06 Striffly

👋 @Striffly

If {:ok, %Bamboo.Email{}} is returned, it means that Bamboo.Mua successfully sent the message and received a delivery receipt from the SMTP server. I couldn't reproduce the issue with Gmail https://github.com/plausible/analytics/discussions/4125#discussioncomment-9594364 so I still think it's a problem on your SMTP relay or hotmail.fr side, probably some spam filtering or similar.

ruslandoga avatar Jun 20 '24 05:06 ruslandoga

At the level of email reception, I am experiencing this issue with two different addresses (hotmail and OVH). Nothing is spam, I've check it like 50 times lol I believe the problem is likely with the SMTP relay. However, the relay I am using comes from a major hosting service, at least in Europe: https://en.wikipedia.org/wiki/OVHcloud. Without it, I can't use custom domain name for my noreply email.

Would it be possible to implement the modification I mentioned to resolve this issue?

Striffly avatar Jun 20 '24 06:06 Striffly

The problem seems to be similar to https://community.ovh.com/t/ovh-smtp-server-issue-any-possible-explanation-welcome/42068/2 as the SMTP transaction is successful but the email is not delivered. Would you be able to reach out to OVH support to file a ticket or start a discussion to investigate it? Solving the root cause would help more people.

ruslandoga avatar Jun 20 '24 06:06 ruslandoga

Meanwhile I'll open a PR to add text_body to all emails.

ruslandoga avatar Jun 20 '24 06:06 ruslandoga

The problem seems to be similar to https://community.ovh.com/t/ovh-smtp-server-issue-any-possible-explanation-welcome/42068/2 as the SMTP transaction is successful but the email is not delivered. Would you be able to reach out to OVH support to file a ticket to investigate it? Solving the root cause would help more people.

Great idea, I'll submit a ticket to bring attention to this issue and have them take a look at it

Meanwhile I'll open a PR to add text_body to all emails.

Thanks !

Striffly avatar Jun 20 '24 06:06 Striffly

👋 @Striffly

I built a new image with #4262 (my build PR: https://github.com/ruslandoga/plausible/pull/315), would you be able to try it out and see if it fixes email delivery?

plausible:
  image: ghcr.io/ruslandoga/plausible:add-text-body-to-all-emails-my-build-223533c

ruslandoga avatar Jun 23 '24 11:06 ruslandoga

@ruslandoga, it works like a charm :tada: I've tested password reset & people invite, and on two email addresses, I received the two emails. Thank you!

Striffly avatar Jun 24 '24 01:06 Striffly

👋 @Striffly

Glad the fix worked for you! 🎉

However, we discussed it on a call and the core team won't merge it due to the extra maintenance burden of two email templates. I'll keep looking for other solutions to the issue without adding text_body.

ruslandoga avatar Jul 17 '24 09:07 ruslandoga

Text emails were added in v2.1.5-rc.1 :)

ruslandoga avatar Jan 17 '25 13:01 ruslandoga