Hi! I decided to experiment with my own instance. Went the docker route, and got everything working, except mail.

I setup postfix, and I can send mail to yahoo from the cli, however neither localhost:25 or actual.fqdm:25 work from the running lemmy_lemmy_1 container. The error is:

  • FQDM: email_send_failed: Connection error: Connection refused (os error 111)
  • localhost:25 email_send_failed: Connection error: Address not available (os error 99)

Has anyone seen this? Feels like a connectivity issue between the running container and host.

This is not letting me save an email address in my user settings.

I guess the intent is for people to use an external smtp service, rather than set up their own?


UPDATE:

tldr; I got mail working with postfix running locally.

  • I tried several “free” smtp relay services, and consistently got timeout errors.
  • Out of frustration, I re-enabled my local postfix server and reconfigured Lemmy back to that.
  • Tailing the postfix logs, I noticed it was rejecting the connection from the Lemmy instance with a relay not allowed error, which had an “internal IP of 192.x” (from the lemmyinternal network).
  • So, I added that IP /32 to “mynetworks” on the host in /etc/postfix/main.cf, restarted postfix, and my instance can now send out emails. Yay!

Thanks for the suggestions everyone. I’ll leave this post here in case anyone else runs into this problem.

  • poVoq@slrpnk.net
    link
    fedilink
    English
    arrow-up
    2
    ·
    1 year ago

    You need to put the container name inside the docker network as the host.

    But besides that, you are not going to have a good time sending many emails from a self-hosted email server because of spam filtering. Better use an external SMTP service.

    • Slashzero@lemmy.mlOP
      link
      fedilink
      English
      arrow-up
      2
      ·
      1 year ago

      Valid point on self hosted SMTP, but I’m just experimenting and didn’t want to waste any money on an SMTP / relay service. But I suppose if folks could recommend a good external smtp service I’ll have a look.

      • Beto@lemmy.studio
        link
        fedilink
        English
        arrow-up
        1
        ·
        1 year ago

        I use Gandi for my domain, and they offer an SMTP server for free. Maybe your registrar has something similar?

        • Slashzero@lemmy.mlOP
          link
          fedilink
          English
          arrow-up
          2
          ·
          edit-2
          1 year ago

          GoDaddy, nothing free, but they have office 365 for $1.99 (USD) a month.

          I’ll check out Gandi, but assume you can only their relay if you registered the domain through them?

          • Beto@lemmy.studio
            link
            fedilink
            English
            arrow-up
            1
            ·
            1 year ago

            That’s right. Another free alternative is creating a Gmail account and using their SMTP.

            • Slashzero@lemmy.mlOP
              link
              fedilink
              English
              arrow-up
              2
              ·
              edit-2
              1 year ago

              I’m trying Brevo right now which has a free SMTP relay allowing 300 emails every 24 hours. The Brevo admin console shows green, relay setup and verified (adding some TXT DNS entries on my domain registrar).

              As far as I can tell, everything is setup, and lemmy.hjson has the email block with the correct smtp-relay address, port, user and password.

              I bring lemmy down and back up to pick up the new settings, but when I go add an email address to my user profile and click save, I get an error:

              email_send_failed: Connection error: time out 0: lemmy_api::local_user::save_settings::perform

              I tried updating to the latest lemmy release candidates for both BE and UI, too. No difference.

    • Slashzero@lemmy.mlOP
      link
      fedilink
      English
      arrow-up
      1
      ·
      edit-2
      1 year ago

      You need to put the container name inside the docker network as the host.

      I was not sure what you meant by this. The closest possibly was this?

      lemmy-ui:
          image: dessalines/lemmy-ui:0.17.4-rc.4
          networks:
            - lemmyinternal
          environment:
            # this needs to match the hostname defined in the lemmy service
            - LEMMY_UI_LEMMY_INTERNAL_HOST=lemmy:8536
            # set the outside hostname here
            - LEMMY_UI_LEMMY_EXTERNAL_HOST=localhost:1236
            - LEMMY_HTTPS=true
          depends_on:
            - lemmy
          restart: always
      

      I changed localhost:1236 to my FQDM:1236 and it did not seem to have any impact either way. Maybe it did? I honestly don’t know. But, I thank you for the help anyway!

  • Beto@lemmy.studio
    link
    fedilink
    English
    arrow-up
    1
    ·
    1 year ago

    You have a typo on localhost, “loclahost”, have you double checked that in the config?

    • Slashzero@lemmy.mlOP
      link
      fedilink
      English
      arrow-up
      0
      arrow-down
      1
      ·
      edit-2
      1 year ago

      Hahah, yeah, that was me fat fingering it here. It’s fine in the config. Nice catch though.

      Also I fixed the typo in the original post. Thanks!