Platoniq / decidim-install

A step-by-step guide to install Decidim on a production site
https://platoniq.github.io/decidim-install/
GNU Affero General Public License v3.0
54 stars 35 forks source link

Sending email with sendgrid #73

Open gillesdeloustal opened 3 years ago

gillesdeloustal commented 3 years ago

This is a complement of platonic page https://github.com/Platoniq/decidim-install/blob/master/basic-config.md First, I recommend to make a backup of the database in order to be able to proceed the creation of the organization as many times as you want in decidim. Go to sendgrid.com and create a free account (or not depending on the expected volume of emails sent every day. The email address of this account is the one you will choose as administrator of the organization. It is not the system administrator that was defined during the installation. Click on email API then integration guide, then smtp relay. You give a name to your api. For example decidim and click on create key. The key is created. Copy and paste it somewhere. You will need it several times. You can click on "verify" to check that sendgrid has received and sent mails. This verification did not work for me, so you can close this page. Optionally, you can follow step by step what is said on the page https://sendgrid.com/docs/for-developers/sending-email/getting-started-smtp/ which tests the correct operation. Once finished, it tells you that everything is ok if everything went well. Now we will insert the key given by sengrid into decidim. Go here to follow platonoic's instructions: https://github.com/Platoniq/decidim-install/blob/master/basic-config.md We skip the lines related to gmail and we type nano ~/decidim-app/config/application.yml Here is the content of the lines that must be added to the file to use sendgrid. The password is the one created with sendgrid SMTP_USERNAME: apikey SMTP_PASSWORD: xxxxffjdmqljfjfmjmfjfjkj SMTPADDRESS: smtp.sendgrid.netSMTP DOMAIN: sendgrid.net If you don't use port 587 used by default by decidim, change the port near the end of the file /home/xxxxx/decidim-app/config/secrets.yml You continue to follow the procedure indicated by platoniq, in particular you modify the file nano/home/pretdegilles/decidim-app/config/initializers/decidim.rb with the name of the application and sender's email. You now get to create your organization in decidim by typing your URL. You fill in everything until SMTP settings. In the lines "sender" : leave email and label. Everything is defined in the file decidim.rb In the username you put apikey In the password you copy the password of sendgrid which was copied (not the base64 for those whofollowed the test with telnet) In smtp host name you type smtp.sendgrid.net In Port you type 587 That's it. You will receive an email to connect. Hope that could help