Encoding problem with attachments #49

jacob-carlborg opened this Issue Oct 9, 2012 · 4 comments


None yet

2 participants


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"
nashby commented Oct 9, 2012

@jacob-carlborg hi, what version of letter_opener are you using?


I'm using 0.1.0.

nashby commented Oct 9, 2012

@jacob-carlborg right, there was a problem. I've just merged #48 and looks like everything works now! Could you test it against master?

@nashby nashby closed this Oct 9, 2012

That worked, and attachments work as well. Awesome, thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment