I cant get my email sending to work on my instance. After trying for hours, i wanted to ask for some support here since im quite stuck and dont understand.

I installed Lemmy using ansible so everything is set up in a very standard way - except email.

I want my instance to send email to an external smtp server (Fastmail) whenever there is a need to send an email (user registration, password reset, etc).

Currently the email settings in lemmy.hjson looks like this:

  email: {
    smtp_server: "postfix:25"
    smtp_login: "[email protected]"
    smtp_password: "fastmail_user_password_here"
    smtp_from_address: "[email protected]"
    tls_type: "tls"
  }

It seems like i need to have postfix:25 as the smtp server. What i really want is to put smtp.fastmail.com:465 here since thats what i want to use to send email. But that doesnt seem to work.

So I understand I need to send email through postfix, but then I wonder, how should the config look like to send emails to smtp.fastmail.com on port 465 (which is what they have on fastmail), with a specific username and password used on the fastmail server?

I think a lot of people are having issues with the email part of the setup, judging from the many reports of spinning buttons on user signup… this is a very likely reason, specially since there is no error message to the user.

Please help me sort this out, how should i configure this?

EDIT:

Ok after a lot of experiments and help from people below, this was the solution.

  email: {
    smtp_server: "smtp.fastmail.com:587"
    smtp_login: "[email protected]"
    smtp_password: "password"
    smtp_from_address: "[email protected]"
    tls_type: "starttls"
  }

Using this, email sending finally works. I couldnt use something else in the smtp_from_address. Which means my real email gets shown to users, so I will probably create another email address for this purpose completely.

Also specific to Hetzner instances, they dont block port 487 so you can use that with starttls.

  • Nina@lemmy.ml
    link
    fedilink
    arrow-up
    1
    ·
    edit-2
    1 year ago

    Similar, I’m assuming gmail is a no go? I feel like theoretically it should work but it’s not. However, this may be because I’m using elest.io -> docker, but something’s fucked up with my domain’s SSL and it’s signed by itself. It gives the browser a big huge 'ol unsecured warning, so I would assume that because that’s messed up it’s causing gmail to not accept it? I’ve opened a ticket with them, so eventually maybe I can figure out if that’s the case, I’ve never had a problem pointing namecheap domains to anything before.

    It says this, but I assure you, the password is correct.

    lemmy_server::api_routes_websocket: email_send_failed: permanent error (535): 5.7.8 Username and Password not accepted. Learn more at5.7.8  https://support.google.com/mail/?p=BadCredentials [long chain of numbers and letters I'm not sure matter] - gsmtp
    

    The settings

      # Email sending configuration. All options except login/password are mandatory
      email: {
        # Hostname and port of the smtp server
        smtp_server: "smtp.gmail.com:587"
        smtp_login: "[email protected]"
        smtp_password: "[the password]"
        # Address to send emails from, eg "[email protected]"
        smtp_from_address: "[email protected]"
        # Whether or not smtp connections should use tls. Can be none, tls, or starttls
        tls_type: "tls"
      }
    

    I also did start stattls and that didn’t work. Tried swapping ports around, nope.

    edit: fixed the ssl issue with elest.io, they just had a configuration wrong, but tbf lemmy support was added literally yesterday