Giter VIP home page Giter VIP logo

letter_opener's Introduction

Letter Opener Ruby

Preview email in the default browser instead of sending it. This means you do not need to set up email delivery in your development environment, and you no longer need to worry about accidentally sending a test email to someone else's address.

Rails Setup

First add the gem to your development environment and run the bundle command to install it.

gem "letter_opener", group: :development

Then set the delivery method in config/environments/development.rb

config.action_mailer.delivery_method = :letter_opener
config.action_mailer.perform_deliveries = true

Now any email will pop up in your browser instead of being sent. The messages are stored in tmp/letter_opener. If you want to change application that will be used to open your emails you should override LAUNCHY_APPLICATION environment variable or set Launchy.application in the initializer.

Configuration

LetterOpener.configure do |config|
  # To overrider the location for message storage.
  # Default value is `tmp/letter_opener`
  config.location = Rails.root.join('tmp', 'my_mails')

  # To render only the message body, without any metadata or extra containers or styling.
  # Default value is `:default` that renders styled message with showing useful metadata.
  config.message_template = :light

  # To change default file URI scheme you can provide `file_uri_scheme` config.
  # It might be useful when you use WSL (Windows Subsystem for Linux) and default
  # scheme doesn't work for you.
  # Default value is blank
  config.file_uri_scheme = 'file://///wsl$/Ubuntu-18.04'
end

Non Rails Setup

If you aren't using Rails, this can be easily set up with the Mail gem. Just set the delivery method when configuring Mail and specify a location.

require "letter_opener"
Mail.defaults do
  delivery_method LetterOpener::DeliveryMethod, location: File.expand_path('../tmp/letter_opener', __FILE__)
end

The method is similar if you're using the Pony gem:

require "letter_opener"
Pony.options = {
  via: LetterOpener::DeliveryMethod,
  via_options: {location: File.expand_path('../tmp/letter_opener', __FILE__)}
}

Alternatively, if you are using ActionMailer directly (without Rails) you will need to add the delivery method.

require "letter_opener"
ActionMailer::Base.add_delivery_method :letter_opener, LetterOpener::DeliveryMethod, :location => File.expand_path('../tmp/letter_opener', __FILE__)
ActionMailer::Base.delivery_method = :letter_opener

Remote Alternatives

Letter Opener uses Launchy to open sent mail in the browser. This assumes the Ruby process is running on the local development machine. If you are using a separate staging server or VM this will not work. In that case consider using Mailtrap or MailCatcher.

If you are running your application within a Docker Container or VM and do not have a browser available to open emails received by Letter Opener, you may see the following error:

WARN: Launchy::CommandNotFoundError: Unable to find a browser command. If this is unexpected, Please rerun with environment variable LAUNCHY_DEBUG=true or the '-d' commandline option and file a bug at https://github.com/copiousfreetime/launchy/issues/new

To resolve this, simply set the following ENV variables:

LAUNCHY_DRY_RUN=true
BROWSER=/dev/null

In order to keep this project simple, I don't have plans to turn it into a Rails engine with an interface for browsing the sent mail but there is a gem you can use for that.

Development & Feedback

Questions or problems? Please use the issue tracker. If you would like to contribute to this project, fork this repository and run bundle and rake to run the tests. Pull requests appreciated.

Special thanks to the mail_view gem for inspiring this project and for their mail template. Also thanks to Vasiliy Ermolovich for helping manage this project.

letter_opener's People

Contributors

amatsuda avatar centrevillage avatar clairemcginty avatar davidcornu avatar fgrehm avatar jaredbeck avatar jeanmertz avatar kmcphillips avatar koic avatar kulgar avatar m-nakamura145 avatar mkdynamic avatar nashby avatar nikitachernov avatar nono avatar olleolleolle avatar pbougie avatar pcg79 avatar petergoldstein avatar phallstrom avatar prdanelli avatar pusewicz avatar ryanb avatar ryanlecompte avatar scarver2 avatar sj26 avatar stevenharman avatar tricknotes avatar tylercollier avatar wesgibbs avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

letter_opener's Issues

Emails are being delivered via letter opener in test, cucumber environments

For some reason, LetterOpener is kicking in during rspec and cucumber runs.

Unfortunately, we send out a lot of emails (user creation, friend requests, etc.) and the tabs opened via letter opener are numbering in the dozens to hundreds.

Gemfile

group :development do
  gem 'letter_opener', '1.0.0'

config/environments/development.rb

  config.action_mailer.delivery_method = :letter_opener

config/environments/test.rb

  config.action_mailer.delivery_method = :test

config/environments/cucumber.rb

  config.action_mailer.delivery_method = :test

No mention of letter_opener in config/environment.rb.

Option to not launch email view in browser

Hi there, just came across this gem and I think it's absolutely brilliant. I'm using it with the Rails engine that is suggested and I like that better than emails opening up in another browser tab. Is it possible to disable the launching?

No HTML head or body

I set up letter_opener as described (with a plain-text only email) and it does open a new tab, but it looks like this:

http://d.pr/i/tMl4

When I view source, there isn't an html, head, or body wrapper.

http://d.pr/i/fMPH
http://d.pr/i/fMPH

My code is pretty straightforward (it's .text.erb):

Order is pending shipping rate

Order details can be reviewed here:

<%= @order_details_url %>

Add a shipping rate here:

<%= @shipping_rate_url %>

This is an automated message sent from the FE Bennett website. For support,
contact ClearSight Studio ([email protected]).

Any ideas?

Email with image as attachment inline

Hi, thank's for this good gem for developers.
But I've a problem with the image as attachment inline on rails 3.2.17-ruby 1.9.3.
If I write the attachments as follow, the mail delivered are showed correctly by letter_opener on browsers

attachments.inline['logo'] = File.read("#{Rails.root}/app/assets/images/logo_header.png")

BUT the mail mail delivered on production to gmail is wrong, so i looked for a solution and I write the new code below for the attachment:

attachments.inline['logo'] = { content: Base64.encode64(File.read("#{Rails.root}/app/assets/images/logo_header.png")),
                               mime_type: "image/png", encoding: "base64"  }

this resolve the gmail client viewer.
But this new code is not good for letter_opener: the inline image is not showed.

Charset not included in mail view

When I insert some UTF-8 characters in the mail, the preview in browser doesn't include the :charset option from mailer (there is no explicit charset encoding in html view of mail)..

subject translations

Any reason why this wouldn't work? Am I doing this correctly, or is it a bug? I'm trying to make my existing and working mailer to work with i18n translations.

# snippet from message_mailer.rb
mail to: ENV['MAILER_USERNAME'], subject: t('message_mailer.new_message', message: @message.name), css: ['mailers/message']
# snippet from en.yml
en
  message_mailer:
    new_message:
      subject: "New message from %{name}"

And the rendered mailer shows a subject like so:

Subject:
{:subject=>"New message from %{name}"}

EDIT: I changed the config from letter_opener to smtp, and this does not seem to be an issue with letter_opener. The actual emails to my inbox reflect the same results as letter_opener. Can anyone help me figure out what I am doing wrong anyways?

.deliver! error

Thanks Ryan for this great gem!

Don't know if this is affecting a lot of users, but I found that in my code there was a deliver with a bang used ".deliver!", and letter opener failed because the deliver! method tries to access "settings" which is not available in LetterOpener.

Working on remote server ?

Is this gem supposed to work on remote servers ? (ie: rails app @ my-host.com, browser triggering email @ random_ip)

If yes, then I'm having problems... If no, could be a feature ?

(Works well on my computer, not with a capistrano deployment (with a development-like stage)

Error when run in vagrant vm

I'm getting this error:

Failure in opening file:///vagrant/tmp/letter_opener/1347902079_5d48af6/plain.html with options {}: Unable to find a browser command.

When I try rails console Launchy.open("file://#{file}")
It give the same error.

Email path on Windows - colon missing?

Hi,

I'm developing on Windows and it looks like the path to email file passed to browser is not correct.
The path I'm getting is:
file://c/Users/marek/holidio/tmp/letter_opener/1319989022_e6a716e/rich.html
and it should be
file://c:/Users/marek/holidio/tmp/letter_opener/1319989022_e6a716e/rich.html

Not sure if there is a way to recognize the OS and apply fix for Windows...?
If not - is there a way to configure letter_opener to not try to open the email?

Thanks,
Marek

Getting: `undefined local variable or method `to_ary' for #<Mail::FromField>`

Hi,

I'm running into an issue with letter_opener where Message#from, #to etc are throwing the following error:
NameError: undefined local variable or methodto_ary' for #Mail::FromField:0x007fae398a28e0`

I've tracked it down to this code:

Array(@mail["from"])
=> NameError: undefined local variable or method `to_ary' for #<Mail::FromField:0x007fae398a28e0>

The strange thing is that whenever I try to do this on a Mail object created manually it works fine:

[11] pry(main)> m = Mail.new(from: "[email protected]", to: "[email protected]") { content_type("text/html; charset=UTF-8"); content_transfer_encoding('quoted-printable'); body("hello!") }
=> #<Mail::Message:70297656821620, Multipart: false, Headers: <From: [email protected]>, <To: [email protected]>, <Content-Type: text/html; charset=UTF-8>, <Content-Transfer-Encoding: quoted-printable>>
[12] pry(main)> Array(m["from"]).join(", ")
=> "[email protected]"

I've tried using the .from syntax to access the Mail objects properties but that seems to open up another can of worms.

This seems to happen since the 2.6.1 version of the Mail gem, so I've tried updating letter_openers Mail gem but the specs also still pass just fine with that version.

This happens on ruby 2.1.3 and 2.1.4.

Hope you can help me out here, if you need any more info please let me know!

Thanks! <3

Controller override

Is it possible to slightly override a controller while still maintaining the very simple mount syntax in routes.rb with letter_opener_web ? If there is already a way, I suggest to edit the README...

It's not really an issue, but no instruction on how to contact you otherwise. Also I wasn't sure whether to post on this issue tracker or letter_opener_web's one ?

A concrete user case is explained here. Your gem was a very straightforward way for me to implement email previews.

An empty "to" recipient list causes an exception

letter_opener erroneously assumes the "to" recipient list can't be empty. It causes an undefined method 'join' for nil:NilClass error.

This is different from ActionMailer, which does allow an empty "to" list. My app sends out a single notification to multiple recipients on the "bcc"; there is no "to".

I have a fix (check my fork) but it also removes .rvmrc because I am using ruby 1.9.3 and rvm won't install 1.9.2 because of ye ol' LLVM conflict. Ruby 1.9.2 it's an unnecessary dependency for this project, and I feel the .rvmrc shouldn't be in the repository anyway. But, if requested I'll roll it back and submit a pull request.

Otherwise, just change message.html.erb#71 from:

<dd><%= mail.to.join(", ") %></dd>

...to...

<dd><%= mail.to.join(", ") unless mail.to.nil? %></dd>

letter_opener still launching browser even with delivery_method set to smtp

Hi there,

Dunno if I am missing something here. I recently changed the config in my app to not use letter_opener in dev, simply like this:

config.action_mailer.delivery_method = :smtp

None the less, I can still see the emails being created in the tmp folder and opened in my browser rather than being sent through smtp. Is there anything else I need to do? Maybe remove the gem as well from the development group?

Email not stored on tmp/mails

After sending emails in the console (see below) or via application' actions, an empty folder is created at tmp/mails

ActionMailer::Base.logger = Logger.new(STDOUT)
class Sender < ActionMailer::Base                                                                                                     
  def mail(to)
    recipients to
    from Environment.default.contact_email 
    reply_to Environment.default.contact_email
    subject "test"
    body render(:text => 'test')
  end
end
Sender.deliver_mail('[email protected]')

I see in tree is:

➜  distribution git:(distribution-plugin) ✗ tree tmp/mails/
tmp/mails/
└── 1377272139_1868e78

My setup with Rails 2.3.15 is:

gem install specific_install
gem specific_install -l git://github.com/cavi21/letter_opener.git

The at config/local.rb I put:

require 'rubygems'
require 'letter_opener'
ActionMailer::Base.delivery_method = :letter_opener
ActionMailer::Base.custom_letter_opener_mailer = LetterOpener::DeliveryMethod.new(:location => Rails.root.join("tmp", "mails"))

Recent update throwing an error `X-Frame-Options to SAMEORIGIN`

Just recently updated Rails to 4.2.1 and I'm seeing this. Not sure what might be causing it. Is this a known issue? I'm guessing this is related to it using an iFrame. I'm not sure what changed though.

Refused to display 'http://localhost:3000/confirm-email?email_confirmation_token=dBLTjydYe_XgqEdDRufseQ' in a frame because it set 'X-Frame-Options' to 'SAMEORIGIN'.

Subject lines are not HTML-escaped

Subject lines are not HTML-escaped. If your subject line is

Hello <world>

You will see:

Hello

Here's the HTML letter_opener generates:

<dt>Subject:</dt>
<dd><strong>Hello <world></strong></dd>

Nothing happens

I followed the instructions (1. Add the gem to Gemfile, run bundle, 2. Set delivery method to :letter_opener in development.rb) and nothing happens when a mail is sent. I scanned through the logs and it looks normal. Tried this with both pow and normal WEBrick server.

Thanks! This looks awesome.

how to make it work with Padrino ?

I tried:

set :delivery_method, LetterOpener::DeliveryMethod
Mail.defaults do
  delivery_method LetterOpener::DeliveryMethod, :location => "tmp/letter_opener"
end

it will display a notice:
The file /letter_opener/1332232643_e1f70f8/plain.html does not exist.

but the file tmp/letter_opener/1332232643_e1f70f8/plain.html is existed

Invalid delivery method :letter_opener

I have set the following setting in development.rb

Mailing Configuration Parameters

config.action_mailer.delivery_method = :letter_opener
ActionMailer::Base.perform_deliveries = true
ActionMailer::Base.raise_delivery_errors = false

Yet I am still receiving an error. Do you have any suggestions?

emails lose responsive styling

Responsive styles (implemented with @media queries) need to be located in a very specific part of the document. letter_opener interferes with this by wrapping the html document output from the template in another html document.

I believe the fix is to wrap the html output in an iframe (like mail_view does). You may have to use srcdoc instead of src.

Stop letter_opener for rake tasks

I am creating dummy users using rake task for my application. An email is opened in bvrowser as I have integrated mail sending feature for user registration. Is there a way that I can disable letter_opener from opening email in browser only for rake tasks or some certain piece of code?

Letter-opener sends email event if there is no recipient

It becomes unreliable if this gem doesn't reciprocate SMTP behavior. Not exactly but letter_opener should raise some kind of error if there is no recipient to send email as corresponding to SMTP:

An SMTP To address is required to send a message. Set the message smtp_envelope_to, to, cc, or bcc address...

non-rails ActionMailer setup

Here's how I got it working with ActionMailer on a non-rails project. Could perhaps go in the Readme.

# Gemfile
gem 'letter_opener', :group => :development

# wherever...
require "letter_opener"

ActionMailer::Base.add_delivery_method :letter_opener, LetterOpener::DeliveryMethod,
  :location => APP_ROOT + "tmp/letter_opener"


ActionMailer::Base.delivery_method = :normal_method
ActionMailer::Base.delivery_method = :letter_opener if ENVIRONMENT == 'development'

Using letter_opener with delayed_job

Hello!

This is more a question than an issue. Hope that is alright.

letter_opener is a very useful gem. I'm using it on all my Email-sending applications.

I've started to use delayed_job for Email delivery but this seems to stop letter_opener from doing its work. Is there a recommended way to have letter_opener and delayed_job work together?

Thanks in advance.

Letter Opener doesn't seem to support deliver_later?

In Rails 4.2 with ActiveJob on Sidekiq in development mode, Letter Opener does not open emails in the browser when using deliver_later!. deliver_now is working great.

I'm uncertain if this a known issue or a bug in my setup.

Also - thanks for the great gem. Makes development of emails so much nicer.

Not creating tmp files?

I put the following in development.rb

config.action_mailer.delivery_method = :letter_opener

But I do not get anything opening or anything in tmp after I restart my server. Any idea?

Email created in tmp/ but not opening

I just upgraded my rvm and ruby (due to the 2.0.0-p353 patch), and as a result reinstalled all gems

since then, letter_opener stopped working on my application. The file is created in tmp/letter_opener and i can manually open them in the browser, but the automatic opening (via Launchy, i think?) is not working

I know it's not something i did in the app itself, since the master branch also has this problem, which my coworkers also use with no problem

Letter Opener Reply

In my rails app, I did a simple hack to enable email replies from letter opener. I needed a reply capability to simulate two-way email traffic in a group messaging system.

letter_opener_reply

How it works:

  1. Override LetterOpener::Message#template - put this code in lib/letter_opener/alt_template:
module LetterOpener
  class Message
    def template
      File.read(File.expand_path("../message.html.erb", __FILE__))
    end
  end
end
  1. Drop this template into lib/letter_opener/message.html.erb

  2. Add require_relative "../lib/letter_opener/alt_template.rb" to config/application.rb. Now letter_opener should display the reply form.

  3. Create a controller letter_opener_reply_controller.rb and modify routes.rb as needed. Now your rails app should process the letter_opener reply.

Hope that this tip is useful to someone else who would like to add a reply feature to letter_opener.

Adding a body margin makes email preview break

I think because the email headers depend on a margin CSS property, applying a body-wide CSS style such as

<body style="font-family: Arial, sans-serif; font-size: 12px; margin:20px;">

makes the preview break.

(please let me know if this is just bad practice on my part.)

RubyGems version vs GitHub

On rubygems, letter_opener is version 1.2.3, but GitHub has version 1.2.0.. It appears that the GitHub version also displays responsive emails properly.

Relative asset paths are invalid

Any asset paths linking to external stylesheets or images are invalid when viewing letter_opener emails. This is, of course, due to the fact that the emails are opened as local files (using file://), and linked stylesheets and images are not exported to the tmp/letter_opener/preview_instance_hash/ directory.

This could be remedied if rails 3 supported this option in the development environment:

ActionMailer::Base.default_url_options = { host: "localhost:3000" }

but this no longer works in Rails 3 (as far as I can tell). Any chance of having this fixed?

No from addresses causes 0-byte rich.html file and cryptic error

I just ran into a problem where letter_opener creates the tmp/letter_opener/subdir directory structure. And it creates the rich.html file. But the file is 0 bytes.

Setting config.action_mailer.perform_deliveries=true showed the error:

NoMethodError (You have a nil object when you didn't expect it!
You might have expected an instance of Array.
The error occurred while evaluating nil.join):
  app/controllers/registrations_controller.rb:16:in `create'

Rendered vendor/ruby/1.9.1/gems/actionpack-3.0.10/lib/action_dispatch/middleware/templates/rescues/_trace.erb (1.9ms)
Rendered vendor/ruby/1.9.1/gems/actionpack-3.0.10/lib/action_dispatch/middleware/templates/rescues/_request_and_response.erb (4.8ms)
Rendered vendor/ruby/1.9.1/gems/actionpack-3.0.10/lib/action_dispatch/middleware/templates/rescues/diagnostics.erb within rescues/layout (10.6ms)

(registrations_controller.rb:16 is a @user.save call)

I realized I'd forgotten to set the default from: address in my Mailer. The error is probably coming from message.html.erb on the line <dd><%= mail.from.join(", ") %></dd>.

I don't know if this is a bug or if not setting the from address in your Mailer is invalid (but Rails never complained about it).

Support to rails 2.3.x

Hi this is not an issue but was not sure where to put it. I adapt this gem to work also for rails 2.3.x for a project that I have to maintain.

The code I written is horrible but is working and don't want to spend time on this since don't see a lot of reasons to put a lot of effort for stuff that are for rails 2.3.x.

I did not make any test, and only use it for text/html in our case, but if someone want to use it is there. https://github.com/cavi21/letter_opener

Sorry Ryan to put this in here, but maybe someone is in the same situation I was.

Have a nice day everyone!

stack level too deep

I'm running into an issue with letter_opener and devise_invitable.
Whenever I include ( don't have to use it in my app ) one or both of the gems
I get this error:

# trying to send email from a rake task
# also crashes when triggering from a controller
rake aborted!
stack level too deep
/Users/webdevotion/.rvm/gems/ruby-1.9.3-p194/gems/rake-10.0.3/lib/rake/task.rb:170

I've been going through ActionMailer and ActionPack but I can't pin the issue.
Using Rails 3.2.12 and made sure I have recent versions of my gems with bundle update.

Strange Encodings

When I use letter_opener some characters come out with funky encodings:

funky encodings

If I send this in production, these characters come through properly:

works when email is sent...

I think the problem might lie in CGI.escapeHTML(message) but I'm not sure. Any ideas on how to fix this so letter_opener displays these properly?

Letter opener does nothing

I have letter_opener 1.1.0, launchy 2.2.0, Rails 3.2.11. I added the line to development.rb as suggested, but nothing happens and tmp/letter_opener is not created (even after restarting the server).

Logs look normal, and email works fine in production. No popup blockers in place. Any ideas why it's not popping the message into a new window?

Managing BCC an CC fields

Hello, just wanted to suggest adding bcc and cc fields to the gem. Awesome gem! Once again thank you very much Ryan!

NoMethodError

I'm getting the following exception in a Rails 2.2.2 app running under ruby-1.8.7-p352:

NoMethodError (undefined method `perform_delivery_letter_opener' for #<Mailer:0x1139b1928>):
/vendor/rails/actionmailer/lib/action_mailer/base.rb:526:in `__send__'
/vendor/rails/actionmailer/lib/action_mailer/base.rb:526:in `deliver!'
/vendor/rails/actionmailer/lib/action_mailer/base.rb:392:in `method_missing'
/app/controllers/comments_controller.rb:56:in `create'
/vendor/rails/actionpack/lib/action_controller/mime_responds.rb:106:in `call'
/vendor/rails/actionpack/lib/action_controller/mime_responds.rb:106:in `respond_to'
/app/controllers/comments_controller.rb:52:in `create'
/vendor/rails/actionpack/lib/action_controller/base.rb:1253:in `send'
/vendor/rails/actionpack/lib/action_controller/base.rb:1253:in `perform_action_without_filters'
/vendor/rails/actionpack/lib/action_controller/filters.rb:617:in `call_filters'
/vendor/rails/actionpack/lib/action_controller/filters.rb:610:in `perform_action_without_benchmark'
/vendor/rails/actionpack/lib/action_controller/benchmarking.rb:68:in `perform_action_without_rescue'
/Users/thomas/.rvm/rubies/ruby-1.8.7-p352/lib/ruby/1.8/benchmark.rb:293:in `measure'
/vendor/rails/actionpack/lib/action_controller/benchmarking.rb:68:in `perform_action_without_rescue'
/vendor/rails/actionpack/lib/action_controller/rescue.rb:136:in `perform_action'
/vendor/rails/actionpack/lib/action_controller/base.rb:524:in `send'
/vendor/rails/actionpack/lib/action_controller/base.rb:524:in `process_without_filters'
/vendor/rails/actionpack/lib/action_controller/filters.rb:606:in `process_without_session_management_support'
/vendor/rails/actionpack/lib/action_controller/session_management.rb:134:in `process'
/vendor/rails/actionpack/lib/action_controller/base.rb:392:in `process'
/lib/unified_request.rb:50:in `handle_request'
/vendor/rails/actionpack/lib/action_controller/dispatcher.rb:110:in `dispatch_unlocked'
/vendor/rails/actionpack/lib/action_controller/dispatcher.rb:123:in `dispatch'
/vendor/rails/actionpack/lib/action_controller/dispatcher.rb:122:in `synchronize'
/vendor/rails/actionpack/lib/action_controller/dispatcher.rb:122:in `dispatch'
/vendor/rails/actionpack/lib/action_controller/dispatcher.rb:132:in `dispatch_cgi'
/vendor/rails/actionpack/lib/action_controller/dispatcher.rb:39:in `dispatch'
/Users/thomas/.rvm/gems/ruby-1.8.7-p352@ben2/gems/thin-1.2.11/lib/rack/adapter/rails.rb:89:in `call'
/Users/thomas/.rvm/gems/ruby-1.8.7-p352@ben2/gems/thin-1.2.11/lib/rack/adapter/rails.rb:69:in `call'
/Users/thomas/.rvm/gems/ruby-1.8.7-p352@ben2/gems/thin-1.2.11/lib/thin/connection.rb:84:in `pre_process'
/Users/thomas/.rvm/gems/ruby-1.8.7-p352@ben2/gems/thin-1.2.11/lib/thin/connection.rb:82:in `catch'
/Users/thomas/.rvm/gems/ruby-1.8.7-p352@ben2/gems/thin-1.2.11/lib/thin/connection.rb:82:in `pre_process'
/Users/thomas/.rvm/gems/ruby-1.8.7-p352@ben2/gems/thin-1.2.11/lib/thin/connection.rb:57:in `process'
/Users/thomas/.rvm/gems/ruby-1.8.7-p352@ben2/gems/thin-1.2.11/lib/thin/connection.rb:42:in `receive_data'
/Users/thomas/.rvm/gems/ruby-1.8.7-p352@ben2/gems/eventmachine-0.12.10/lib/eventmachine.rb:256:in `run_machine'
/Users/thomas/.rvm/gems/ruby-1.8.7-p352@ben2/gems/eventmachine-0.12.10/lib/eventmachine.rb:256:in `run'
/Users/thomas/.rvm/gems/ruby-1.8.7-p352@ben2/gems/thin-1.2.11/lib/thin/backends/base.rb:61:in `start'
/Users/thomas/.rvm/gems/ruby-1.8.7-p352@ben2/gems/thin-1.2.11/lib/thin/server.rb:159:in `start'
/Users/thomas/.rvm/gems/ruby-1.8.7-p352@ben2/gems/thin-1.2.11/lib/thin/controllers/controller.rb:86:in `start'
/Users/thomas/.rvm/gems/ruby-1.8.7-p352@ben2/gems/thin-1.2.11/lib/thin/runner.rb:185:in `send'
/Users/thomas/.rvm/gems/ruby-1.8.7-p352@ben2/gems/thin-1.2.11/lib/thin/runner.rb:185:in `run_command'
/Users/thomas/.rvm/gems/ruby-1.8.7-p352@ben2/gems/thin-1.2.11/lib/thin/runner.rb:151:in `run!'
/vendor/rails/railties/lib/commands/servers/thin.rb:20
/vendor/rails/activesupport/lib/active_support/dependencies.rb:153:in `require'
/vendor/rails/activesupport/lib/active_support/dependencies.rb:153:in `require'
/vendor/rails/activesupport/lib/active_support/dependencies.rb:521:in `new_constants_in'
/vendor/rails/activesupport/lib/active_support/dependencies.rb:153:in `require'
/vendor/rails/railties/lib/commands/server.rb:49
script/server:3:in `require'
script/server:3

emulate restrictions of mail clients

There are tons of restrictions in mail clients. In gmail, every css must be inlined in to the elements, otherwise you won't see any css at all.

Just watching the html in browsers does not help much, the gem must emulate the behaviour of the mail clients to make it perfect as a testing tool

Here is a list of css elements that are supported on different mail clients:

http://www.campaignmonitor.com/css/

Encoding problem with attachments

I have an encoding problem with sending emails with attachments. This is the error I get when trying to send an email with an attachment in the Rails console:

Encoding::CompatibilityError: incompatible character encodings: UTF-8 and ASCII-8BIT

It's working fine if I use SMTP as the delivery method. The attachment is a PDF-file, version 1.5 according to the file command in Mac OS X. I'm setting the attachment as follows:

def attach_file (name, path, mime_type = "application/pdf")
  content = File.read(path)
  attachments[name] = {
    mime_type: mime_type,
    content: content,
    encoding: "Base64"
  }
end

Minimum Rails Version?

Just added to my project and got this error:

.rvm/gems/ruby-1.8.7-p358/gems/activesupport-2.3.11/lib/active_support/dependencies.rb:466:in `load_missing_constant': uninitialized constant Rails::Railtie (NameError)

Is this a Rails 3+ only gem?

Attachments?

Hi,

Is it possible to show attachments with letter opener? Right now they don't show, so I have no clue if they worked.

Many thanks

CC and BCC broken

When using cc and bcc the message output tried to call .join on them, but they are already strings.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.