Open Source Platform for DTC, B2B Commerce, Marketplaces & Omnichannel. REST APIs, TypeScript SDKs, and production-ready Next.js storefront. Self-host it. Own your data. No vendor lock-in. Zero platform fees.
Ruby b2b-commercee-commerceecommerceecommerce-apiecommerce-frameworkecommerce-platformheadlessheadless-commerceheadless-ecommercemarketplacemulti-tenantmulti-vendormulti-vendor-ecommerceopen-sourcespree-commerce
Docs: added deployment Emails guide
Damian Legawiecbbc3c3f09140
diff --git a/docs/developer/deployment/caching.mdx b/docs/developer/deployment/caching.mdxindex 5446823a08..7c44ddbecb 100644--- a/docs/developer/deployment/caching.mdx+++ b/docs/developer/deployment/caching.mdx@@ -31,7 +31,16 @@ Now, you will need to change the `config/environments/production.rb` from:to:```ruby-config.cache_store = :redis_cache_store+if ENV['REDIS_CACHE_URL'].present?+ cache_servers = ENV['REDIS_CACHE_URL'].split(',') # if multiple instances are provided+ config.cache_store = :redis_cache_store, {+ url: cache_servers,+ connect_timeout: 30, # Defaults to 1 second+ read_timeout: 0.2, # Defaults to 1 second+ write_timeout: 0.2, # Defaults to 1 second+ reconnect_attempts: 2, # Defaults to 1+ }+end```For more advanced configuration options, please refer to the [Spree Starter repository](https://github.com/spree/spree_starter/blob/main/config/environments/production.rb#L72).diff --git a/docs/developer/deployment/emails.mdx b/docs/developer/deployment/emails.mdxnew file mode 100644index 0000000000..c973365eb1--- /dev/null+++ b/docs/developer/deployment/emails.mdx@@ -0,0 +1,33 @@+---+title: Sending out Emails+sidebarTitle: Emails+icon: "envelope"+description: Learn how to send transactional emails from your Spree application.+---++Spree uses [ActionMailer](https://guides.rubyonrails.org/action_mailer_basics.html) to send transactional emails (eg. order confirmation, password reset, etc.) under the hood. You can use any SMTP server to send emails from your application. For production use we recommend using a service like [SendGrid](https://sendgrid.com/).++## Configuring SendGrid++Spree Starter comes with SendGrid pre-configured out of the box and you will need to set the following environment variables:++* `SENDGRID_API_KEY` - Your SendGrid API key. Can be found in the [SendGrid dashboard](https://app.sendgrid.com/settings/api_keys).+* `SENDGRID_DOMAIN` - The domain you want to use for sending emails that was verified in SendGrid, eg. `mystore.com`.++If you're not using Spree Starter you will need to add these code in your `config/environments/production.rb` file:++```ruby+ if ENV['SENDGRID_API_KEY'].present?+ ActionMailer::Base.smtp_settings = {+ user_name: 'apikey', # This is the string literal 'apikey', NOT the ID of your API key+ password: ENV['SENDGRID_API_KEY'], # This is the secret sendgrid API key which was issued during API key creation+ domain: ENV.fetch('SENDGRID_DOMAIN', Rails.application.routes.default_url_options[:host]),+ address: 'smtp.sendgrid.net',+ port: 587,+ authentication: :plain,+ enable_starttls_auto: true+ }+ end+```++That's it! You can now send emails from your application.\ No newline at end of filediff --git a/docs/developer/deployment/environment_variables.mdx b/docs/developer/deployment/environment_variables.mdxindex 541f8b674e..5ba1c5e9e9 100644--- a/docs/developer/deployment/environment_variables.mdx+++ b/docs/developer/deployment/environment_variables.mdx@@ -30,4 +30,5 @@ There are also some other environment variables that you can set to customize yo| `REDIS_CACHE_URL` | Redis URL, used for caching, this could be your AWS ElastiCache instance or any other Redis instance (optional, if not provided will use file based cache) | | `redis://localhost:6379/1` || `SCREENSHOT_API_TOKEN` | [Screenshot API token](https://screenshotapi.net/) (optional, used for screenshot generation) | | `1234132512341234` || `SENDGRID_API_KEY` | [SendGrid API key](https://docs.sendgrid.com/api-reference/api-keys) (optional, if not provided will not send transactional emails) | | `SG.1234567890` |+| `SENDGRID_DOMAIN` | The domain you want to use for sending emails that was verified in SendGrid | | `mystore.com` || `SENTRY_DSN` | Sentry DSN (optional, if not provided will not send errors to [Sentry](https://sentry.io/)) | | `https://sentry.io/...` |diff --git a/docs/docs.json b/docs/docs.jsonindex f66c18ad7b..82e357f036 100644--- a/docs/docs.json+++ b/docs/docs.json@@ -76,6 +76,7 @@"developer/deployment/render","developer/deployment/docker","developer/deployment/environment_variables",+ "developer/deployment/emails","developer/deployment/assets","developer/deployment/cdn","developer/deployment/caching"