Hello!

I have procrastinated configuring the e-mail server for my instance. I am looking into it and it is not entirely clear to me how I should go about it.

I see that some docker-compose files have the following block added:

 postfix:
     image: mwader/postfix-relay
     environment:
       - POSTFIX_myhostname=${domain}
     restart: "always"

But I don’t understand whether this is supposed to work out-of-the box (which it did not for me when I tried), or if I need to set up the postfix server as one usually would and the postfix-relay somehow makes the connection between docker container and the already configured server. Is there a guide for complete beginners? I could not find one in the lemmy docs and I have never configured an e-mail server before. I am reading through the postfix documentation and already got some basics but there is a lot, and I am not sure that I am moving efficiently towards the end goal 😅

  • nutomic@lemmy.ml
    link
    fedilink
    arrow-up
    4
    ·
    3 years ago

    Yes that image takes full care of email sending, you just have to add it to the Lemmy config. Explanation is on Docker Hub. One thing you should do for email sending is set proper reverse DNS (which reminds me, it might not be set for lemmy.ml either).

    • SalamanderOPA
      link
      fedilink
      arrow-up
      4
      ·
      3 years ago

      Thank you! That is helpful. I have made progress. Now I get a message saying “email_send_failed” and an “Address family not supported by protocol” error from the lemmy logs:

      lemmy_1           | 2022-03-24T18:36:31.741763Z ERROR Websocket Request{trace_id=00000000000000000000000000000000}: lemmy_websocket::handlers: Error during message handling email_send_failed: Connection error: Address family not supported by protocol (os error 97)
      lemmy_1           |    0: lemmy_websocket::handlers::Websocket Request
      lemmy_1           |            with trace_id=00000000000000000000000000000000
      lemmy_1           |              at crates/websocket/src/handlers.rs:68
      
      

      I think that this error is related to trying to use an ipv6 address at some point, and my server only has ipv4. I will try to fix this… But at least I am moving forward! I will figure out how to set up the reverse DNS after.

  • SalamanderOPA
    link
    fedilink
    arrow-up
    1
    ·
    edit-2
    2 years ago

    It has been 10 months since I posted this, but I have gotten back to it.

    After some troubleshooting, I eventually found out that my mistake was that I was using the wrong hostname in the lemmy.hjson config file.

    I was setting the hostname in the config file to ‘mander.xyz:25’, but it should have been “postfix:25”

    So, my e-mail configuration in the lemmy.hjson file now says:

    email: {
      # Hostname and port of the smtp server
      smtp_server: "postfix:25"
      # Address to send emails from, eg noreply@your-instance.com
      smtp_from_address: "Mander <noreply@mander.xyz>"
      # Whether or not smtp connections should use tls. Can be none, tls, or starttls
      tls_type: "none"
    }
    
    

    And the block in docker-compose.yml is:

    
      postfix:
        image: mwader/postfix-relay
        environment:
          - POSTFIX_myhostname=mander.xyz
          - POSTFIX_inet_protocols=ipv4
        restart: "always"
    
    

    And this works. I am still having some problems with my DKIM signature, but the e-mails at least get sent to the spam folder.