I’m using the Lemmy ansible installation method. I’ve been trying to add sendgrid to the postfix section of the config.hjson file on my local machine. But where do I add the API key and username? I used port 587 but nothing works. Can anyone help walk me through how to integrate sendgrid into Lemmy-Ansible? Thanks!!

the email section of config.hjson looks like this, did I do this right?

  email: {
    smtp_server: "smtp.sendgrid.net:587"
    smtp_from_address: "noreply@{{ domain }}"
    tls_type: "tls"
  }

I was able to find the server location on my VPS under srv/lemmy/domain, so I can edit the lemmy.hjson file there if need be.

  • hitagi@ani.social
    Aquileo | link
    Aquileo | fedilink
    Aquileo | arrow-up
    2
    ·
    3 years ago

    You need smtp_login and smtp_password there. Not sure what that is for Sendgrid however. It might be your accoint sername/email and the API key. Sendgrid probably has docs for their SMTP server.

    • ZMonster@lemmy.worldOP
      Aquileo | link
      Aquileo | fedilink
      Aquileo | arrow-up
      1
      ·
      3 years ago

      Thanks for getting back to me!

      Okay, sendgrid gives me this:

      Configure your application with the settings below.
       	Server 	smtp.sendgrid.net
       	Ports 	25, 587 	(for unencrypted/TLS connections)
      		465  	(for SSL connections)
       	Username 	apikey
       	Password 	theApiKeyGeneratedBySendgrid
      

      I edited my lemmy.hjson file to this:

        email: {
          smtp_server: "smtp.sendgrid.net:25" #also tried ports 587 and 465 with no difference
          smtp_login: "apikey"
          smtp_password: "theApiKeyGeneratedBySendgrid"
          smtp_from_address: "noreply@myDomain"
          tls_type: "tls" #also tried "none" with no difference
        }
      

      The only change is that now when I select “forgot password” the button turns into a rotating arrow for a few seconds and then nothing. No emails in spam, nothing. Any ideas? I feel like I’m getting closer, and maybe I’m using the port wrong?

      • hitagi@ani.social
        Aquileo | link
        Aquileo | fedilink
        Aquileo | arrow-up
        1
        ·
        3 years ago

        I went through the Sendgrid docs and your configuration seems to be correct. Just to make sure, your login is literally just “apikey” right? As indicated in the docs.

        The rotating arrow means that the email is not sending out.

        You can also try starttls (port 587) if tls and none does not work.

        • ZMonster@lemmy.worldOP
          Aquileo | link
          Aquileo | fedilink
          Aquileo | arrow-up
          2
          ·
          3 years ago

          try starttls (port 587)

          😃 OMG it just worked! Thank you so much!!! You have no idea how excited I am to get my instance up and live! Here is my current lemmy.hjson after a successful ansible install:

            email: {
              smtp_server: "smtp.sendgrid.net:587"
              smtp_login: "apikey"
              smtp_password: "theActualApiKey"
              smtp_from_address: "[email protected]"
              tls_type: "starttls"
            }
          

          For others, I’m using digitalOcean for my VPS and sendgrid for the SMTP relay.