this post was submitted on 08 Jun 2023
2 points (100.0% liked)

Lemmy Support

4651 readers
1 users here now

Support / questions about Lemmy.

Matrix Space: #lemmy-space

founded 5 years ago
MODERATORS
 

I have issues using postfix on my digitalocean droplet (they block the smtp port). Is it possible to setup using SendGrid for the email verification and notifications ?

top 9 comments
sorted by: hot top controversial new old
[–] saint@group.lt 3 points 1 year ago (1 children)

you should be able to use any mail gateway that supports smtp. one way to do it is to configure postfix to use sendgrid as relayhost - https://docs.sendgrid.com/for-developers/sending-email/postfix

[–] majorswitcher@lemmy.one 2 points 1 year ago (1 children)

i've installed via Ansible. do you know where I can find the postfix config file ?

[–] saint@group.lt 2 points 1 year ago (1 children)

you can define it as environment variables in https://github.com/LemmyNet/lemmy-ansible/blob/main/templates/docker-compose.yml i.e mine contains these lines:

  postfix:
    image: mwader/postfix-relay
    environment:
      - POSTFIX_myhostname=group.lt
      - POSTFIX_inet_protocols=ipv4
      - POSTFIX_smtp_sasl_auth_enable=yes
      - POSTFIX_smtp_sasl_password_maps=static:smtp_username:smtp_password
      - POSTFIX_smtp_tls_security_level=may
      - POSTFIX_smtp_sasl_security_options=noanonymous
      - POSTFIX_relayhost=sendgridsmtpserver:serverport
      - OPENDKIM_DOMAINS=group.lt
    restart: "always"
[–] majorswitcher@lemmy.one 3 points 1 year ago* (last edited 1 year ago) (1 children)

thanks! got it working now. In SendGrip generated an api key, at - POSTFIX_smtp_sasl_password_maps=static:smtp_username:smtp_password filled in apikey:[theapikey] and relayhost=smtp.sendgrid.net:587

also add a verified From address in SendGrid, which is added in your lemmy.hjson email.smtp_from_address

[–] worldcitizen101@sopuli.xyz 1 points 1 year ago (1 children)

Thank you for sharing!

I'm trying to figure this out and I'm stuck at creating the file to save the API key. Where did you put the file in the lemmy-ansible setup?

Now you need to specify your credentials (use apikey as username and an API Key as password) in the separate file /etc/postfix/sasl_passwd (you'll likely need to create it):

[–] majorswitcher@lemmy.one 1 points 1 year ago (1 children)

after installing with ansible, change the docker-compose.yml file on you server passing the api in the ENV variable:

the postfix section now looks like this

  postfix:
    image: mwader/postfix-relay
    environment:
      - POSTFIX_myhostname=[yourdomain.tld]
      - POSTFIX_inet_protocols=ipv4
      - POSTFIX_smtp_sasl_auth_enable=yes
      - POSTFIX_smtp_sasl_password_maps=static:apikey:[api-key]
      - POSTFIX_smtp_tls_security_level=may
      - POSTFIX_smtp_sasl_security_options=noanonymous
      - POSTFIX_relayhost=smtp.sendgrid.net:587
      - OPENDKIM_DOMAINS=[yourdomain.tld]
    restart: "always"
[–] worldcitizen101@sopuli.xyz 1 points 1 year ago
[–] sexy_peach@feddit.de 1 points 1 year ago
[–] majorswitcher@lemmyfly.org 1 points 1 year ago
load more comments
view more: next ›