Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions app/assets/images/email/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Email Assets

Images in this folder are used in transactional emails sent by the planner
application. They are referenced via the Rails asset pipeline with digest
fingerprinting.

## ⚠️ Do not modify or delete existing files

The digest fingerprint is derived from the file content. Changing an image
here changes its URL. Any previously-sent email that references the old URL
will show a broken image in the recipient's inbox.

**Additive changes only.** Need a new image for a new email? Add a new file.
Need a new logo? Add it as a new filename (e.g. `logo-2026.png`) and update
the mailer view to reference the new file. Never mutate an existing file.

## Email stylesheet

The email CSS lives at `app/assets/stylesheets/email.css` — not in this
folder — but it's referenced by mailer layouts via the pipeline path
`email.css`.
Binary file added app/assets/images/email/website-logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 1 addition & 2 deletions app/views/shared_mailers/_body_header.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@
%table{ bgcolor: "#fdfdfd" }
%tr
%td{ width: "40%" }
// TODO: maybe get this from codebar.io
= image_tag("https://raw.githubusercontent.com/codebar/assets/master/logo/png/website-logo.png", alt: "codebar logo")
= image_tag("email/website-logo.png", alt: "codebar logo")
%td{ align: "right" }
%h6.collapse= title
%td
2 changes: 1 addition & 1 deletion app/views/shared_mailers/_header.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@
%meta{ 'http-equiv' => "Content-Type", content: "text/html; charset=UTF-8" }
%title=title

%link{rel: "stylesheet", type: "text/css", href: "/assets/email.css"}
%link{rel: "stylesheet", type: "text/css", href: asset_path("email.css")}
3 changes: 3 additions & 0 deletions config/environments/development.rb
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@
# Set localhost to be used by links generated in mailer templates.
config.action_mailer.default_url_options = { host: "localhost", port: 3000 }

# Host for absolute asset URLs in emails (for local email preview).
config.action_mailer.asset_host = "http://localhost:3000"

# Print deprecation notices to the Rails logger.
config.active_support.deprecation = :log

Expand Down
3 changes: 3 additions & 0 deletions config/environments/production.rb
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,9 @@
# Set host to be used by links generated in mailer templates.
config.action_mailer.default_url_options = { host: 'codebar.io' }

# Host for absolute asset URLs in emails. Override for staging via ASSET_HOST env var.
config.action_mailer.asset_host = ENV.fetch('ASSET_HOST', 'https://codebar.io')

# Specify outgoing SMTP server. Remember to add smtp/* credentials via rails credentials:edit.
config.action_mailer.smtp_settings = {
port: '587',
Expand Down