EDIT: I have it working now! I had to set up DKIM and configure my server so Digital Ocean created the proper PTR records. Now email is being sent to spam but at least it’s making it through!

Hopefully this is the last time I need to bug you guys here about stuff. :)

I added a postfix relay to my Lemmy instance and configured the email settings in my lemmy.conf file but no matter what I do I keep getting a “no_email_setup” error when I try to test the SMTP server. Is there an obvious step I’m missing?

This is my full docker-compose.yml:

version: "3.3"

networks:
  lemmyexternalproxy:
  lemmyinternal:
    driver: bridge
    internal: true

services:
  proxy:
    image: nginx:1-alpine
    networks:
      - lemmyinternal
      - lemmyexternalproxy
    ports:
      # only ports facing any connection from outside
      - 80:80 
      - 443:443
    volumes:
      - ./nginx.conf:/etc/nginx/nginx.conf:ro
      # setup your certbot and letsencrypt config 
      - ./certbot:/var/www/certbot
      - /etc/letsencrypt:/etc/letsencrypt
    restart: always
    depends_on:
      - pictrs
      - lemmy-ui

  lemmy:
    image: dessalines/lemmy:0.17.3
    hostname: lemmy
    networks:
      - lemmyinternal
      - lemmyexternalproxy
    restart: always
    environment:
      - RUST_LOG="warn,lemmy_server=info,lemmy_api=info,lemmy_api_common=info,lemmy_api_crud=info,lemmy_apub=info,lemmy_db_schema=info,lemmy_db_views=info,lemmy_db_views_actor=info,lemmy_db_views_moderator=info,lemmy_routes=info,lemmy_utils=info,lemmy_websocket=info"
    volumes:
      - ./lemmy.hjson:/config/config.hjson
    depends_on:
      - postgres
      - pictrs

  lemmy-ui:
    image: dessalines/lemmy-ui:0.17.3
    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

  pictrs:
    image: asonix/pictrs:0.3.1
    # this needs to match the pictrs url in lemmy.hjson
    hostname: pictrs
    # we can set options to pictrs like this, here we set max. image size and forced format for conversion
    # entrypoint: /sbin/tini -- /usr/local/bin/pict-rs -p /mnt -m 4 --image-format webp
    networks:
      - lemmyinternal
    environment:
      - PICTRS__API_KEY=API_KEY
    user: 991:991
    volumes:
      - ./volumes/pictrs:/mnt
    restart: always

  postgres:
    image: postgres:15-alpine
    # this needs to match the database host in lemmy.hson
    hostname: postgres
    networks:
      - lemmyinternal
    environment:
      - POSTGRES_USER=lemmy
      - POSTGRES_PASSWORD=PASSWORD
      - POSTGRES_DB=lemmy
    volumes:
      - ./volumes/postgres:/var/lib/postgresql/data
    restart: always
  
  postfix:
    image: mwader/postfix-relay
    networks:
      - lemmyinternal
      - lemmyexternalproxy
    environment:
      - POSTFIX_myhostname=myhostname.here
      - POSTFIX_inet_protocols=ipv4
    restart: always

And my lemmy.hjson has this block:

email: {
  smtp_server: "postfix:25"
  smtp_from_address: "Lemmy <noreply@myhostname.here>"
  tls_type: "none"
}
  • @penguin_ex_machina@lemmy.worldOP
    link
    fedilink
    English
    1
    edit-2
    1 year ago

    It looks like email is getting blocked because I need to set up SPF or DKIM. From my postfix logs:

    This mail is unauthenticated, which poses a security risk to the 550-5.7.26 sender and Gmail users, and has been blocked. The sender must 550-5.7.26 authenticate with at least one of SPF or DKIM.
    

    Now I’m off to figure that out!

    EDIT: It works now! Emails are currently being sent to spam but at least it’s making it to my inbox.