Skip to content

Latest commit

 

History

History
76 lines (54 loc) · 3.35 KB

sparkpost_and_mailtrap.md

File metadata and controls

76 lines (54 loc) · 3.35 KB

SparkPost & Mailtrap

⚠️ Always use subaccounts in Sparkpost!

Otherwise there may be compliance issues which can lead to the closing down of the whole Renuo account.

Introduction

Main (Sparkpost, [email protected])

  • Each app is using a separate subaccount under the main account
  • The Domain should be set up and verified under the subaccount's sending domains
  • Login: [email protected]

Develop (Sparkpost, renuoapp.ch)

  • Each app is using a separate subaccount under the main account

  • The emails will be sent with *@renuoapp.ch as your mail sender

  • Login: [email protected]

  • If you want, you can also use Mailtrap for develop. Create a new Inbox https://mailtrap.io/inboxes and use this credentials

Testing (Mailtrap)

  • Login: [email protected]
  • The Email will be caught by Mailtrap and not forwarded to the intended receiver
  • You can login to Mailtrap to see the sent email

Sparkpost

⚠️ Always use subaccounts for the project, so that the whole account doesn't get suspended / blocked in case of compliance issues!

  1. Go to https://app.sparkpost.com/auth and log in with the credentials for sparkpost+enviroment@renuo.ch found in the credential store
  2. Create one new subaccount and name it like your project
  3. Create a new API-Key for your subaccount and assign it to the new subaccount, with the following permissions: Send via SMTP, Sending Domains: Read/Write
  4. Write down the API-key in the credential store (in a list under sparkpost+enviroment@renuo.ch), because it's only showed once!
  5. Credentials for SMTP setup on your app can be found here, password is your generated API-key
  6. (if domain is known) Add your sending domain here. Assign it to the subaccount. Set up SPF, DKIM and DMARC with TXT DNS records (only use renuoapp.ch within the [email protected])
  7. Verify your Email DNS configuration with https://mxtoolbox.com/SuperTool.aspx
  8. Set up your ENV-variables and test if the mails are working. Manual test emails can be send via the following command in the rails console (production environment): ActionMailer::Base.mail(to: '[email protected]', from: ENV['MAIL_SENDER'], subject: 'Testmail', body: 'Mail content').deliver_now!
  9. Send a test email to https://www.mail-tester.com/ or https://www.experte.com/spam-checker and check the result

For DNS setup also see Go Live

ENV-variables example:

MAIL_USERNAME: 'SMTP_Injection'
MAIL_PASSWORD:  'YOUR API KEY'
MAIL_HOST: 'smtp.sparkpostmail.com'
MAIL_SENDER: 'Sample App <[email protected]>'

Or with a custom domain:

MAIL_SENDER: 'Sample App <[email protected]>'

Mailtrap

ENV-variables example:

MAIL_USERNAME: 'found in credential store'
MAIL_PASSWORD:  'found in credential store'
MAIL_HOST: 'smtp.mailtrap.io'
MAIL_SENDER: 'Sample App <[email protected]>'

Set up your ENV-variables and test if the mails are working. Manual test emails can be send via the following command in the rails console (production environment): ActionMailer::Base.mail(to: '[email protected]', from: ENV['MAIL_SENDER'], subject: 'Testmail', body: 'Mail content').deliver_now!