Method: Mail::Message#errors
- Defined in:
- lib/mail/message.rb
#errors ⇒ Object
Returns a list of parser errors on the header, each field that had an error will be reparsed as an unstructured field to preserve the data inside, but will not be used for further processing.
It returns a nested array of [field_name, value, original_error_message] per error found.
Example:
= Mail.new("Content-Transfer-Encoding: weirdo\r\n")
.errors.size #=> 1
.errors.first[0] #=> "Content-Transfer-Encoding"
.errors.first[1] #=> "weirdo"
.errors.first[3] #=> <The original error message exception>
This is a good first defence on detecting spam by the way. Some spammers send invalid emails to try and get email parsers to give up parsing them.
406 407 408 |
# File 'lib/mail/message.rb', line 406 def errors header.errors end |