Skip to content

armgit / maybe

Public Imported from GitHub
0

The personal finance app for everyone

Initial email settings (#286)

Josh Pigfordadd40025502b
diff --git a/.env.example b/.env.example
index c65380a2..d4e15f07 100644
--- a/.env.example
+++ b/.env.example
@@ -1,2 +1,13 @@
# Used to enable specific features unique to the hosted version of Maybe. There's a very high likelihood that you don't need to change this value.
-HOSTED=false
\ No newline at end of file
+HOSTED=false
+
+# SMTP Configuration
+# This is only needed if you intend on sending emails from your Maybe instance (such as for password resets or email financial reports).
+# Resend.com is a good option that offers a free tier for sending emails.
+SMTP_ADDRESS=
+SMTP_PORT=25
+SMTP_DOMAIN=
+SMTP_USERNAME=
+SMTP_PASSWORD=
+SMTP_AUTHENTICATION=plain
+SMTP_ENABLE_STARTTLS_AUTO=true
\ No newline at end of file
diff --git a/README.md b/README.md
index 4874f2fe..9e717468 100644
--- a/README.md
+++ b/README.md
@@ -51,6 +51,14 @@ bin/dev
And visit [http://localhost:3000](http://localhost:3000)
+### Email
+
+In development, we use `letter_opener` to automatically open emails in your browser. However, if you self-host, you'll likely want some basic email sending abilities.
+
+You can use any SMTP-based mail service and then simply drop in your SMPT credentials in the `.env` file.
+
+[Resend](https://resend.com) is a great option for personal use as they have a very generous free plan.
+
## Contributing
Before contributing, you'll likely find it helpful to [understand context and general vision/direction](https://github.com/maybe-finance/maybe/wiki).
diff --git a/config/environments/production.rb b/config/environments/production.rb
index 173f449e..741a98ca 100644
--- a/config/environments/production.rb
+++ b/config/environments/production.rb
@@ -67,6 +67,17 @@ Rails.application.configure do
config.action_mailer.perform_caching = false
+ config.action_mailer.delivery_method = :smtp
+ config.action_mailer.smtp_settings = {
+ address: ENV["SMTP_ADDRESS"],
+ port: ENV["SMTP_PORT"],
+ domain: ENV["SMTP_DOMAIN"],
+ user_name: ENV["SMTP_USERNAME"],
+ password: ENV["SMTP_PASSWORD"],
+ authentication: ENV["SMTP_AUTHENTICATION"],
+ enable_starttls_auto: ENV["SMTP_ENABLE_STARTTLS_AUTO"]
+ }
+
# Ignore bad email addresses and do not raise email delivery errors.
# Set this to true and configure the email server for immediate delivery to raise delivery errors.
# config.action_mailer.raise_delivery_errors = false