mail.rb 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. # encoding: utf-8
  2. module Mail # :doc:
  3. require 'date'
  4. require 'shellwords'
  5. require 'uri'
  6. require 'net/smtp'
  7. require 'mime/types'
  8. if RUBY_VERSION <= '1.8.6'
  9. begin
  10. require 'tlsmail'
  11. rescue LoadError
  12. raise "You need to install tlsmail if you are using ruby <= 1.8.6"
  13. end
  14. end
  15. if RUBY_VERSION >= "1.9.0"
  16. require 'mail/version_specific/ruby_1_9'
  17. RubyVer = Ruby19
  18. else
  19. require 'mail/version_specific/ruby_1_8'
  20. RubyVer = Ruby18
  21. end
  22. require 'mail/version'
  23. require 'mail/core_extensions/nil'
  24. require 'mail/core_extensions/object'
  25. require 'mail/core_extensions/string'
  26. require 'mail/core_extensions/shell_escape'
  27. require 'mail/core_extensions/smtp' if RUBY_VERSION < '1.9.3'
  28. require 'mail/indifferent_hash'
  29. # Only load our multibyte extensions if AS is not already loaded
  30. if defined?(ActiveSupport)
  31. require 'active_support/inflector'
  32. else
  33. require 'mail/core_extensions/string/access'
  34. require 'mail/core_extensions/string/multibyte'
  35. require 'mail/multibyte'
  36. end
  37. require 'mail/patterns'
  38. require 'mail/utilities'
  39. require 'mail/configuration'
  40. # Autoload mail send and receive classes.
  41. require 'mail/network'
  42. require 'mail/message'
  43. require 'mail/part'
  44. require 'mail/header'
  45. require 'mail/parts_list'
  46. require 'mail/attachments_list'
  47. require 'mail/body'
  48. require 'mail/field'
  49. require 'mail/field_list'
  50. require 'mail/envelope'
  51. parsers = %w[ rfc2822_obsolete rfc2822 address_lists phrase_lists
  52. date_time received message_ids envelope_from rfc2045
  53. mime_version content_type content_disposition
  54. content_transfer_encoding content_location ]
  55. parsers.each do |parser|
  56. begin
  57. # Try requiring the pre-compiled ruby version first
  58. require 'treetop/runtime'
  59. require "mail/parsers/#{parser}"
  60. rescue LoadError
  61. # Otherwise, get treetop to compile and load it
  62. require 'treetop/runtime'
  63. require 'treetop/compiler'
  64. Treetop.load(File.join(File.dirname(__FILE__)) + "/mail/parsers/#{parser}")
  65. end
  66. end
  67. # Autoload header field elements and transfer encodings.
  68. require 'mail/elements'
  69. require 'mail/encodings'
  70. require 'mail/encodings/base64'
  71. require 'mail/encodings/quoted_printable'
  72. require 'mail/matchers/has_sent_mail'
  73. # Finally... require all the Mail.methods
  74. require 'mail/mail'
  75. end