class Mail::Sendmail
def shellquote(address)
- Allows '+' to accept email addresses with them
- Wraps in double quotes
with the following modifications:
The following is an adaptation of ruby 1.9.2's shellwords.rb file,
def shellquote(address) # Process as a single byte sequence because not all shell # implementations are multibyte aware. # # A LF cannot be escaped with a backslash because a backslash + LF # combo is regarded as line continuation and simply ignored. Strip it. escaped = address.gsub(/([^A-Za-z0-9_\s\+\-.,:\/@~])/n, "\\\\\\1").gsub("\n", '') %("#{escaped}") end