Reputation: 4575
I'm sending email from my Rails 3 application:
mail(
:subject => "My Subject",
:to => "\"#{user.full_name}\" <#{user.email}>",
...
But what happens if user entered his name as John "The Great" Doe
? Obviously, this would break my quoting of the user's name. But would the email still be delivered? Should I somehow escape the user's name when used in the "To" email field? And if yes, how: double quotes, or backslashes, etc?
Upvotes: 2
Views: 211
Reputation: 4495
What you're really asking is how RFC2822 wants such things to be quoted. See:
http://www.ietf.org/rfc/rfc2822.txt
Note that quoting in general is a much more complicated problem than you may imagine -- quotation marks are only one of many problems you face.
That said, I would hope that Rails handles a bunch of this on your behalf -- it is commonly needed and complicated. (I am not a rails guy so I can't answer that for sure.)
Upvotes: 1