Skip to content

Weekly/monthly report emails cannot be sent over SMTP #827

Closed

Description

@ukutaht

Turns out that many SMTP servers reject emails where a single line exceeds 998 characters ¯_(ツ)_/¯

The standard seems really arbitrary but it's not going to change. We should break up the HTML of those emails such that no line can exceed the maximum length.

Activity

  1. bhavin192 commented on Mar 11, 2021

    @bhavin192
    Contributor

    Is there any automated way in the templating to achieve this? I can spend some time on this if it needs to be done manually / need to edit all the HTML templates.

  2. mattsmallman commented on Mar 15, 2021

    @mattsmallman

    This issue also appears to be preventing the selfhosted version sending weekly emails. Logs from bytemark/smtp container:

    1077 LOG: smtp_connection MAIN 1077 SMTP connection from plausible_plausible_1.nginx-proxy (analytics.test.com) [172.20.0.14] closed by QUIT 1078 LOG: MAIN REJECT 1078 H=plausible_plausible_1.nginx-proxy (analytics.test.com) [172.20.0.14] F=<analytics@test.com> rejected after DATA: maximum allowed line length is 998 octets, got 1360 1078 LOG: smtp_connection MAIN 1078 SMTP connection from plausible_plausible_1.nginx-proxy (analytics.test.com) [172.20.0.14] closed by QUIT 1079 LOG: MAIN REJECT 1079 H=plausible_plausible_1.nginx-proxy (analytics.test.com) [172.20.0.14] F=<analytics@test.com> rejected after DATA: maximum allowed line length is 998 octets, got 1360 1079 LOG: smtp_connection MAIN 1079 SMTP connection from plausible_plausible_1.nginx-proxy (analytics.test.com) [172.20.0.14] closed by QUIT

  3. bhavin192 commented on Mar 15, 2021

    @bhavin192
    Contributor

    Exactly, that's how we found this issue: #756

  4. ukutaht commented on Mar 15, 2021

    @ukutaht
    ContributorAuthor

    Looks like this was actually addressed in the underlying SMTP adapter library: https://github.com/fewlinesco/bamboo_smtp/blob/develop/CHANGELOG.md#300---2020-09-10

    EDIT: better link: fewlinesco/bamboo_smtp#141

    So all we need to do is upgrade bamboo_smtp to v4 and it should work.

    The next planned self-hosted release is in the summer and I said I wouldn't patch any existing versions to lower my overhead (I'm the only maintainer). However, this is a serious issue preventing people from using a core feature of the platform. So I will patch the latest release with this version upgrade.

  5. ukutaht commented on Mar 15, 2021

    @ukutaht
    ContributorAuthor

    Can you please test tag v1.2.1 to see if it fixes the issue?

    You can wait until next monday or trigger the email manually:

    $ docker exec -it hosting_plausible_1 /app/bin/plausible remote
    iex> site = Plausible.Repo.get_by(Plausible.Site, domain: "plausible.io")
    iex> Plausible.Workers.SendEmailReport.perform(%{"interval" => "weekly", "site_id" => site.id})
    :ok
    

    Make sure the site has a weekly report configured. NB: The function will return :ok even if it failed. Check SMTP logs to see if it actually went through.

  6. ukutaht commented on Mar 15, 2021

    @ukutaht
    ContributorAuthor

    Can you please test tag v1.2.1 to see if it fixes the issue?

    You can wait until next monday or trigger the email manually:

    $ docker exec -it hosting_plausible_1 /app/bin/plausible remote
    iex> site = Plausible.Repo.get_by(Plausible.Site, domain: "plausible.io")
    iex> Plausible.Workers.SendEmailReport.perform(%{"interval" => "weekly", "site_id" => site.id})
    :ok
    

    Make sure the site has a weekly report configured. NB: The function will return :ok even if it failed. Check SMTP logs to see if it actually went through.

    Ignore this for now. Upgrading bamboo_smtp broke everything. Looking into a soluton.

  7. bhavin192 commented on Mar 15, 2021

    @bhavin192
    Contributor

    I was trying one Exim (bytemark/smtp uses it) workaround for this, and used the above steps with v1.2.0.

    Plausible.Workers.SendEmailReport.perform(%{"interval" => "weekly", "site_id" => site.id})
    ** (UndefinedFunctionError) function Plausible.Workers.SendEmailReport.perform/1 is undefined or private. Did you mean one of:
    
          * perform/2
    
        (plausible 0.0.1) Plausible.Workers.SendEmailReport.perform(%{"interval" => "weekly", "site_id" => 1})
    

    I think the _job argument needs to be provided?

  8. ukutaht commented on Mar 15, 2021

    @ukutaht
    ContributorAuthor

    I was trying one Exim (bytemark/smtp uses it) workaround for this, and used the above steps with v1.2.0.

    Plausible.Workers.SendEmailReport.perform(%{"interval" => "weekly", "site_id" => site.id})
    ** (UndefinedFunctionError) function Plausible.Workers.SendEmailReport.perform/1 is undefined or private. Did you mean one of:
    
          * perform/2
    
        (plausible 0.0.1) Plausible.Workers.SendEmailReport.perform(%{"interval" => "weekly", "site_id" => 1})
    

    I think the _job argument needs to be provided?

    Yes it can be nil

  9. ukutaht commented on Mar 16, 2021

    @ukutaht
    ContributorAuthor
  10. ukutaht commented on Mar 30, 2021

    @ukutaht
    ContributorAuthor

    Managed to find the issue and upgrade the dependency. I've created a release candidate for v1.3.0 which includes a fix for email delivery over SMTP.

    Find the changelog and installation instructions here: https://github.com/plausible/analytics/releases/tag/v1.3.0-rc.0

    If you do decide to try out the release candidate, please leave a message here. I will address any issues and if everything seems smooth I will create a proper release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions