plausible / analytics

Simple, open source, lightweight (< 1 KB) and privacy-friendly web analytics alternative to Google Analytics.
https://plausible.io
GNU Affero General Public License v3.0
18.95k stars 1.02k forks source link

Bamboo.Mua configuration fix for some mailing servers #4249

Open Striffly opened 1 week ago

Striffly commented 1 week ago

Past Issues Searched

Issue is a Bug Report

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: "xxx@hotmail.fr", 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: "xxx@hotmail.fr", 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: "xxx@hotmail.fr", 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 :

- 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

```markdown
- OS: Debian 12
- Plausible environment: Docker
- Browser: Chromium
- Browser Version: 126.0.6478.61
ruslandoga commented 1 week ago

πŸ‘‹ @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.

Striffly commented 1 week ago

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?

ruslandoga commented 1 week ago

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 commented 1 week ago

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

Striffly commented 1 week ago

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 !

ruslandoga commented 1 week ago

πŸ‘‹ @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
Striffly commented 1 week ago

@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!