I am trying to setup my own lemmy server. I used ansible.

I can access my server via my domain just fine. But emails are not working.

First i had my mail and mx records pointing to privateemail via namecheap.

Then i tried using cloudflare email routing and their mx records.

neither worked for me with error connecting.

I thought maybe using dovecot? But self hosting email is new to me

I was hoping to use namecheaps privateemail but wasn’t sure how to get it working.

The email account worked and can send / receive but Lemmy and postfix cannot communicate with it.

Now I have no Mx records as I’m not sure what I should be using I am sure I am missing something obvious but idk what

Any ideas ?

  • Wander@yiffit.net
    link
    fedilink
    English
    arrow-up
    6
    ·
    1 year ago

    You don’t need MX records for outgoing mail. Mailjet works well for me and gives you 200 free daily mails.

  • Matthew@lemmy.piperservers.net
    link
    fedilink
    English
    arrow-up
    6
    arrow-down
    1
    ·
    1 year ago

    Since nobody bothers to check previous posts (even from just a day or two ago), I won’t bother with the details. All I will say is to learn the purposes of an MX record and how sending email works (and the differences). Hint: MX records have nothing to do with sending emails from your server. Just use a third party SMTP service in your config.hjson file.

    • FrayDabson@vlemmy.netOP
      link
      fedilink
      English
      arrow-up
      1
      arrow-down
      2
      ·
      1 year ago

      Oh I read plenty posts. I am no expert so not always easy for me to understand relating their experiences to mine.

      I was under the impression that postfix is all that was needed. And my config.hjson file is pointing to postfix. The issue that caused me to get confused and go down a very incorrect rabbit hole was that the postfix logs repeatedly error about connecting to my Mx record servers.

  • Jamie@jamie.moe
    link
    fedilink
    English
    arrow-up
    2
    arrow-down
    1
    ·
    1 year ago

    For my instance, I already have an MXRoute account that I use for my personal email, so I just set up an account on there and pointed Lemmy at that. I’ve been down the road of self-hosting email, and it is a dreadful experience.

    Granted, that was with full inboxes and POP3, just hosting the send part might not be so bad. But then you have to contend with possibly being on spam lists, and those are hard to get yourself removed from. If you have some cash to let someone else deal with that headache for you, I fully encourage taking that route.

  • FrayDabson@vlemmy.netOP
    link
    fedilink
    English
    arrow-up
    2
    arrow-down
    1
    ·
    1 year ago

    The errors are coming from the postfix docker that it cannot communicate with any Mx server I tried.

      • Wander@yiffit.net
        link
        fedilink
        English
        arrow-up
        5
        arrow-down
        1
        ·
        1 year ago

        I use external smtp and have had no problems over several versions.

        OP, please share your config.hjson (redacting all sensitive info)

        • Max-P@lemmy.max-p.me
          link
          fedilink
          English
          arrow-up
          2
          ·
          1 year ago

          Working perfectly fine here as well. From the backend’s perspective, a relay or an external server shouldn’t be functionally different whatsoever.

          • Morethanevil@lmy.mymte.de
            link
            fedilink
            English
            arrow-up
            0
            ·
            edit-2
            1 year ago

            Could you help me with the setup of the SMTP via lemmy.hjson?

            Mine looks like this:

            email: {
                smtp_server: "smtp.domain.de:465"
                smtp_login: "admin@domain.de"
                smtp_password: "secretpass"
                smtp_from_address: "admin@domain.de"
                tls_type: "tls"
              }
            
            • Max-P@lemmy.max-p.me
              link
              fedilink
              English
              arrow-up
              2
              ·
              1 year ago

              That really should work, I would check for potential firewall issues or something.

              Mine is basically identical to yours:

              email: {
                  smtp_server: "mail.h.max-p.me:465"
                  smtp_login: "lemmy@max-p.me"
                  smtp_password: "REDACTED"
                  smtp_from_address: "lemmy@max-p.me"
                  tls_type: "tls"
                }
              

              It’s possible your server is slightly misconfigured and actually serve plain traffic on 465 and requires the use of the STARTTLS command.

              Can you reach your server with openssl?

              openssl s_client -connect smtp.domain.de:465
              

              This should end up with something like that:

                  Start Time: 1688422790
                  Timeout   : 7200 (sec)
                  Verify return code: 0 (ok)
                  Extended master secret: no
                  Max Early Data: 0
              ---
              read R BLOCK
              220 hosting.max-p.me ESMTP Postfix
              
  • FrayDabson@vlemmy.netOP
    link
    fedilink
    English
    arrow-up
    1
    ·
    1 year ago

    Thank you to those that helped. As I figured I was being a noob and missing a key piece. Based off the instructions and my experience I didn’t realize I need to get a free or paid smtp service and point postfix to that server. Everything seems to be working now.

    • terribleplan@lemmy.nrd.li
      link
      fedilink
      English
      arrow-up
      2
      ·
      edit-2
      1 year ago

      Summarizing the relevant parts of an eerily similar conversation I had the other day:

      If you are using the built-in mail relay then you aren’t signing your mail with DKIM, don’t have SPF set up right, don’t have a DMARC policy, and don’t have FcRDNS, all of which basically any mail provider will require from you to even consider accepting your mail. Basically without all of that literally anyone can pretend to be whatever.com and send email from it. They really shouldn’t be shipping that mail relay at all IMO, it just leads to confusion. More than likely you would already know if you need a mail relay and be able to set it up yourself if so.

      Sendgrid and Postmark are popular transactional mail services (which is what sort of email you will be sending, google that term to find more options). If you want some help getting your own mail server set up in a dockerized way I run my mail using docker-mailserver and if only set up for outgoing mail it is pretty easy to run, though you will probably run into deliverability issues as the large providers (google, microsoft, apple, etc) can be real assholes and assume anything from a non-large provider is spam. Feel free to ask me about how to do it if you are interested though, the more people run their own mail the better it gets for all of us.