Encoding problem with attachments #49

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

Projects

None yet

2 participants

@jacob-carlborg

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

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

@jacob-carlborg

I'm using 0.1.0.

@nashby
Collaborator
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
@jacob-carlborg

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