{"id":13462980,"url":"https://github.com/basecamp/mail_view","last_synced_at":"2025-12-18T03:11:54.111Z","repository":{"id":49391039,"uuid":"620885","full_name":"basecamp/mail_view","owner":"basecamp","description":"Visual email testing","archived":true,"fork":false,"pushed_at":"2018-02-08T08:07:12.000Z","size":441,"stargazers_count":1330,"open_issues_count":11,"forks_count":128,"subscribers_count":25,"default_branch":"master","last_synced_at":"2025-03-25T05:55:53.118Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/basecamp.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2010-04-21T04:39:59.000Z","updated_at":"2024-10-18T13:52:51.000Z","dependencies_parsed_at":"2022-08-26T05:22:29.142Z","dependency_job_id":null,"html_url":"https://github.com/basecamp/mail_view","commit_stats":null,"previous_names":["37signals/mail_view"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/basecamp%2Fmail_view","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/basecamp%2Fmail_view/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/basecamp%2Fmail_view/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/basecamp%2Fmail_view/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/basecamp","download_url":"https://codeload.github.com/basecamp/mail_view/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245413807,"owners_count":20611353,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-07-31T13:00:43.244Z","updated_at":"2025-12-18T03:11:54.083Z","avatar_url":"https://github.com/basecamp.png","language":"Ruby","readme":"MailView -- Visual email testing\n================================\n\nPreview plain text and html mail templates in your browser without redelivering it every time you make a change.\n\nRails 4.1\n---------\nNOTE: MailView is part of Rails 4.1+. No need for the plugin anymore!\n\n* 4.1.0 API docs: http://api.rubyonrails.org/v4.1.0/classes/ActionMailer/Base.html#class-ActionMailer::Base-label-Previewing+emails\n* Release notes: http://edgeguides.rubyonrails.org/4_1_release_notes.html#action-mailer-previews\n* Pull request: https://github.com/rails/rails/pull/13332/files\n\n\nInstall\n-------\n\nAdd the gem to your `Gemfile`:\n\n```ruby\n  gem 'mail_view', :git =\u003e 'https://github.com/basecamp/mail_view.git'\n  # or\n  gem \"mail_view\", \"~\u003e 2.0.4\"\n```\n\nAnd run `bundle install`.\n\nUsage\n-----\n\nSince most emails do something interesting with database data, you'll need to write some scenarios to load messages with fake data. Its similar to writing mailer unit tests but you see a visual representation of the output instead.\n\n```ruby\n  # app/mailers/mail_preview.rb or lib/mail_preview.rb\n  class MailPreview \u003c MailView\n    # Pull data from existing fixtures\n    def invitation\n      account = Account.first\n      inviter, invitee = account.users[0, 2]\n      Notifier.invitation(inviter, invitee) \n    end\n\n    # Factory-like pattern\n    def welcome\n      user = User.create!\n      mail = Notifier.welcome(user)\n      user.destroy\n      mail\n    end\n\n    # Stub-like\n    def forgot_password\n      user = Struct.new(:email, :name).new('name@example.com', 'Jill Smith')\n      mail = UserMailer.forgot_password(user)\n    end\n  end\n```\n\nMethods must return a [Mail][1] or [TMail][2] object. Using ActionMailer, call `Notifier.create_action_name(args)` to return a compatible TMail object. Now on ActionMailer 3.x, `Notifier.action_name(args)` will return a Mail object.\n\nRouting\n-------\n\nA mini router middleware is bundled for Rails 2.x support.\n\n```ruby\n  # config/environments/development.rb\n  config.middleware.use MailView::Mapper, [MailPreview]\n```\n\nFor Rails³ you can map the app inline in your routes config.\n\n```ruby\n  # config/routes.rb\n  if Rails.env.development?\n    mount MailPreview =\u003e 'mail_view'\n  end\n```\n\nNow just load up `http://localhost:3000/mail_view`.\n\nInterface\n---------\n\n![Plain text view](http://img18.imageshack.us/img18/1066/plaintext.png)\n![HTML view](http://img269.imageshack.us/img269/2944/htmlz.png)\n\n\n[1]: http://github.com/mikel/mail\n[2]: http://github.com/mikel/tmail\n","funding_links":[],"categories":["Communication","Ruby"],"sub_categories":["E-Mail Preview"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbasecamp%2Fmail_view","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbasecamp%2Fmail_view","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbasecamp%2Fmail_view/lists"}