jorgemanrubia / mailgun_rails

Rails Action Mailer adapter for Mailgun
MIT License
210 stars 70 forks source link

Commas in FROM: cause "undefined method `formatted' for Mail::UnstructuredField" #48

Closed MaffooClock closed 9 years ago

MaffooClock commented 9 years ago

After nearly an hour of hair-pulling, I've discovered that if the from: display name contains a comma, Mailgun throws an exception NoMethodError (undefined method 'formatted' for #<Mail::UnstructuredField:0x007fba8303c8f8>).

Examples:

Acme Manufacturing, Inc. <noreply@acmemfg.com> # <-- Throws Exception
Acme Manufacturing Inc. <noreply@acmemfg.com>  # <-- OK
MaffooClock commented 9 years ago

Actually, I forgot that a comma is a delimiter for multiple addresses, so I'll have to figure out a way to escape it.

MaffooClock commented 8 years ago

Heh, more than a year later, and I found myself in this pitfall again!

Although not specific to this project, here's a tip: %Q["#{addressee_name}" <#{email_address}>]

dkam commented 7 years ago

I just came across this too.

kalinchuk commented 5 years ago

This seems to happen whenever the from: and to: fields are not formatted correctly (extra commas and periods seem to be the common ones)