actionmailer 2.3.18 → 3.0.0.beta
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of actionmailer might be problematic. Click here for more details.
- data/CHANGELOG +13 -16
- data/README +39 -21
- data/lib/action_mailer/adv_attr_accessor.rb +14 -18
- data/lib/action_mailer/base.rb +437 -560
- data/lib/action_mailer/collector.rb +36 -0
- data/lib/action_mailer/delivery_methods.rb +86 -0
- data/lib/action_mailer/deprecated_api.rb +139 -0
- data/lib/action_mailer/mail_helper.rb +25 -13
- data/lib/action_mailer/old_api.rb +248 -0
- data/lib/action_mailer/quoting.rb +4 -2
- data/lib/action_mailer/railtie.rb +25 -0
- data/lib/action_mailer/railties/subscriber.rb +20 -0
- data/lib/action_mailer/test_case.rb +4 -6
- data/lib/action_mailer/test_helper.rb +0 -1
- data/lib/action_mailer/tmail_compat.rb +34 -0
- data/lib/action_mailer/version.rb +3 -3
- data/lib/action_mailer.rb +25 -30
- metadata +41 -161
- data/Rakefile +0 -97
- data/install.rb +0 -30
- data/lib/action_mailer/helpers.rb +0 -113
- data/lib/action_mailer/part.rb +0 -107
- data/lib/action_mailer/part_container.rb +0 -55
- data/lib/action_mailer/utils.rb +0 -7
- data/lib/action_mailer/vendor/text-format-0.6.3/text/format.rb +0 -1466
- data/lib/action_mailer/vendor/text_format.rb +0 -10
- data/lib/action_mailer/vendor/tmail-1.2.7/tmail/Makefile +0 -18
- data/lib/action_mailer/vendor/tmail-1.2.7/tmail/address.rb +0 -392
- data/lib/action_mailer/vendor/tmail-1.2.7/tmail/attachments.rb +0 -65
- data/lib/action_mailer/vendor/tmail-1.2.7/tmail/base64.rb +0 -46
- data/lib/action_mailer/vendor/tmail-1.2.7/tmail/compat.rb +0 -41
- data/lib/action_mailer/vendor/tmail-1.2.7/tmail/config.rb +0 -67
- data/lib/action_mailer/vendor/tmail-1.2.7/tmail/core_extensions.rb +0 -63
- data/lib/action_mailer/vendor/tmail-1.2.7/tmail/encode.rb +0 -590
- data/lib/action_mailer/vendor/tmail-1.2.7/tmail/header.rb +0 -962
- data/lib/action_mailer/vendor/tmail-1.2.7/tmail/index.rb +0 -9
- data/lib/action_mailer/vendor/tmail-1.2.7/tmail/interface.rb +0 -1162
- data/lib/action_mailer/vendor/tmail-1.2.7/tmail/loader.rb +0 -3
- data/lib/action_mailer/vendor/tmail-1.2.7/tmail/mail.rb +0 -578
- data/lib/action_mailer/vendor/tmail-1.2.7/tmail/mailbox.rb +0 -496
- data/lib/action_mailer/vendor/tmail-1.2.7/tmail/main.rb +0 -6
- data/lib/action_mailer/vendor/tmail-1.2.7/tmail/mbox.rb +0 -3
- data/lib/action_mailer/vendor/tmail-1.2.7/tmail/net.rb +0 -250
- data/lib/action_mailer/vendor/tmail-1.2.7/tmail/obsolete.rb +0 -132
- data/lib/action_mailer/vendor/tmail-1.2.7/tmail/parser.rb +0 -1060
- data/lib/action_mailer/vendor/tmail-1.2.7/tmail/parser.y +0 -416
- data/lib/action_mailer/vendor/tmail-1.2.7/tmail/port.rb +0 -379
- data/lib/action_mailer/vendor/tmail-1.2.7/tmail/quoting.rb +0 -164
- data/lib/action_mailer/vendor/tmail-1.2.7/tmail/require_arch.rb +0 -58
- data/lib/action_mailer/vendor/tmail-1.2.7/tmail/scanner.rb +0 -49
- data/lib/action_mailer/vendor/tmail-1.2.7/tmail/scanner_r.rb +0 -262
- data/lib/action_mailer/vendor/tmail-1.2.7/tmail/stringio.rb +0 -280
- data/lib/action_mailer/vendor/tmail-1.2.7/tmail/utils.rb +0 -362
- data/lib/action_mailer/vendor/tmail-1.2.7/tmail/vendor/rchardet-1.3/COPYING +0 -504
- data/lib/action_mailer/vendor/tmail-1.2.7/tmail/vendor/rchardet-1.3/README +0 -12
- data/lib/action_mailer/vendor/tmail-1.2.7/tmail/vendor/rchardet-1.3/lib/rchardet/big5freq.rb +0 -927
- data/lib/action_mailer/vendor/tmail-1.2.7/tmail/vendor/rchardet-1.3/lib/rchardet/big5prober.rb +0 -42
- data/lib/action_mailer/vendor/tmail-1.2.7/tmail/vendor/rchardet-1.3/lib/rchardet/chardistribution.rb +0 -238
- data/lib/action_mailer/vendor/tmail-1.2.7/tmail/vendor/rchardet-1.3/lib/rchardet/charsetgroupprober.rb +0 -112
- data/lib/action_mailer/vendor/tmail-1.2.7/tmail/vendor/rchardet-1.3/lib/rchardet/charsetprober.rb +0 -75
- data/lib/action_mailer/vendor/tmail-1.2.7/tmail/vendor/rchardet-1.3/lib/rchardet/codingstatemachine.rb +0 -64
- data/lib/action_mailer/vendor/tmail-1.2.7/tmail/vendor/rchardet-1.3/lib/rchardet/constants.rb +0 -42
- data/lib/action_mailer/vendor/tmail-1.2.7/tmail/vendor/rchardet-1.3/lib/rchardet/escprober.rb +0 -89
- data/lib/action_mailer/vendor/tmail-1.2.7/tmail/vendor/rchardet-1.3/lib/rchardet/escsm.rb +0 -244
- data/lib/action_mailer/vendor/tmail-1.2.7/tmail/vendor/rchardet-1.3/lib/rchardet/eucjpprober.rb +0 -88
- data/lib/action_mailer/vendor/tmail-1.2.7/tmail/vendor/rchardet-1.3/lib/rchardet/euckrfreq.rb +0 -596
- data/lib/action_mailer/vendor/tmail-1.2.7/tmail/vendor/rchardet-1.3/lib/rchardet/euckrprober.rb +0 -42
- data/lib/action_mailer/vendor/tmail-1.2.7/tmail/vendor/rchardet-1.3/lib/rchardet/euctwfreq.rb +0 -430
- data/lib/action_mailer/vendor/tmail-1.2.7/tmail/vendor/rchardet-1.3/lib/rchardet/euctwprober.rb +0 -42
- data/lib/action_mailer/vendor/tmail-1.2.7/tmail/vendor/rchardet-1.3/lib/rchardet/gb2312freq.rb +0 -474
- data/lib/action_mailer/vendor/tmail-1.2.7/tmail/vendor/rchardet-1.3/lib/rchardet/gb2312prober.rb +0 -42
- data/lib/action_mailer/vendor/tmail-1.2.7/tmail/vendor/rchardet-1.3/lib/rchardet/hebrewprober.rb +0 -289
- data/lib/action_mailer/vendor/tmail-1.2.7/tmail/vendor/rchardet-1.3/lib/rchardet/jisfreq.rb +0 -570
- data/lib/action_mailer/vendor/tmail-1.2.7/tmail/vendor/rchardet-1.3/lib/rchardet/jpcntx.rb +0 -229
- data/lib/action_mailer/vendor/tmail-1.2.7/tmail/vendor/rchardet-1.3/lib/rchardet/langbulgarianmodel.rb +0 -229
- data/lib/action_mailer/vendor/tmail-1.2.7/tmail/vendor/rchardet-1.3/lib/rchardet/langcyrillicmodel.rb +0 -330
- data/lib/action_mailer/vendor/tmail-1.2.7/tmail/vendor/rchardet-1.3/lib/rchardet/langgreekmodel.rb +0 -227
- data/lib/action_mailer/vendor/tmail-1.2.7/tmail/vendor/rchardet-1.3/lib/rchardet/langhebrewmodel.rb +0 -202
- data/lib/action_mailer/vendor/tmail-1.2.7/tmail/vendor/rchardet-1.3/lib/rchardet/langhungarianmodel.rb +0 -226
- data/lib/action_mailer/vendor/tmail-1.2.7/tmail/vendor/rchardet-1.3/lib/rchardet/langthaimodel.rb +0 -201
- data/lib/action_mailer/vendor/tmail-1.2.7/tmail/vendor/rchardet-1.3/lib/rchardet/latin1prober.rb +0 -147
- data/lib/action_mailer/vendor/tmail-1.2.7/tmail/vendor/rchardet-1.3/lib/rchardet/mbcharsetprober.rb +0 -89
- data/lib/action_mailer/vendor/tmail-1.2.7/tmail/vendor/rchardet-1.3/lib/rchardet/mbcsgroupprober.rb +0 -45
- data/lib/action_mailer/vendor/tmail-1.2.7/tmail/vendor/rchardet-1.3/lib/rchardet/mbcssm.rb +0 -542
- data/lib/action_mailer/vendor/tmail-1.2.7/tmail/vendor/rchardet-1.3/lib/rchardet/sbcharsetprober.rb +0 -124
- data/lib/action_mailer/vendor/tmail-1.2.7/tmail/vendor/rchardet-1.3/lib/rchardet/sbcsgroupprober.rb +0 -56
- data/lib/action_mailer/vendor/tmail-1.2.7/tmail/vendor/rchardet-1.3/lib/rchardet/sjisprober.rb +0 -88
- data/lib/action_mailer/vendor/tmail-1.2.7/tmail/vendor/rchardet-1.3/lib/rchardet/universaldetector.rb +0 -168
- data/lib/action_mailer/vendor/tmail-1.2.7/tmail/vendor/rchardet-1.3/lib/rchardet/utf8prober.rb +0 -87
- data/lib/action_mailer/vendor/tmail-1.2.7/tmail/vendor/rchardet-1.3/lib/rchardet.rb +0 -67
- data/lib/action_mailer/vendor/tmail-1.2.7/tmail/version.rb +0 -39
- data/lib/action_mailer/vendor/tmail-1.2.7/tmail.rb +0 -6
- data/lib/action_mailer/vendor/tmail.rb +0 -17
- data/lib/actionmailer.rb +0 -2
- data/test/abstract_unit.rb +0 -62
- data/test/asset_host_test.rb +0 -54
- data/test/delivery_method_test.rb +0 -51
- data/test/fixtures/asset_host_mailer/email_with_asset.html.erb +0 -1
- data/test/fixtures/auto_layout_mailer/hello.html.erb +0 -1
- data/test/fixtures/auto_layout_mailer/multipart.text.html.erb +0 -1
- data/test/fixtures/auto_layout_mailer/multipart.text.plain.erb +0 -1
- data/test/fixtures/explicit_layout_mailer/logout.html.erb +0 -1
- data/test/fixtures/explicit_layout_mailer/signup.html.erb +0 -1
- data/test/fixtures/first_mailer/share.erb +0 -1
- data/test/fixtures/helper_mailer/use_example_helper.erb +0 -1
- data/test/fixtures/helper_mailer/use_helper.erb +0 -1
- data/test/fixtures/helper_mailer/use_helper_method.erb +0 -1
- data/test/fixtures/helper_mailer/use_mail_helper.erb +0 -5
- data/test/fixtures/helpers/example_helper.rb +0 -5
- data/test/fixtures/layouts/auto_layout_mailer.html.erb +0 -1
- data/test/fixtures/layouts/auto_layout_mailer.text.erb +0 -1
- data/test/fixtures/layouts/spam.html.erb +0 -1
- data/test/fixtures/path.with.dots/funky_path_mailer/multipart_with_template_path_with_dots.erb +0 -1
- data/test/fixtures/raw_email +0 -14
- data/test/fixtures/raw_email10 +0 -20
- data/test/fixtures/raw_email12 +0 -32
- data/test/fixtures/raw_email13 +0 -29
- data/test/fixtures/raw_email2 +0 -114
- data/test/fixtures/raw_email3 +0 -70
- data/test/fixtures/raw_email4 +0 -59
- data/test/fixtures/raw_email5 +0 -19
- data/test/fixtures/raw_email6 +0 -20
- data/test/fixtures/raw_email7 +0 -66
- data/test/fixtures/raw_email8 +0 -47
- data/test/fixtures/raw_email9 +0 -28
- data/test/fixtures/raw_email_quoted_with_0d0a +0 -14
- data/test/fixtures/raw_email_with_invalid_characters_in_content_type +0 -104
- data/test/fixtures/raw_email_with_nested_attachment +0 -100
- data/test/fixtures/raw_email_with_partially_quoted_subject +0 -14
- data/test/fixtures/second_mailer/share.erb +0 -1
- data/test/fixtures/templates/signed_up.erb +0 -3
- data/test/fixtures/test_mailer/_subtemplate.text.plain.erb +0 -1
- data/test/fixtures/test_mailer/body_ivar.erb +0 -2
- data/test/fixtures/test_mailer/custom_templating_extension.text.html.haml +0 -6
- data/test/fixtures/test_mailer/custom_templating_extension.text.plain.haml +0 -6
- data/test/fixtures/test_mailer/implicitly_multipart_example.ignored.erb +0 -1
- data/test/fixtures/test_mailer/implicitly_multipart_example.rhtml.bak +0 -1
- data/test/fixtures/test_mailer/implicitly_multipart_example.text.html.erb +0 -10
- data/test/fixtures/test_mailer/implicitly_multipart_example.text.html.erb~ +0 -10
- data/test/fixtures/test_mailer/implicitly_multipart_example.text.plain.erb +0 -2
- data/test/fixtures/test_mailer/implicitly_multipart_example.text.yaml.erb +0 -1
- data/test/fixtures/test_mailer/included_subtemplate.text.plain.erb +0 -1
- data/test/fixtures/test_mailer/rxml_template.builder +0 -2
- data/test/fixtures/test_mailer/rxml_template.rxml +0 -2
- data/test/fixtures/test_mailer/signed_up.html.erb +0 -3
- data/test/fixtures/test_mailer/signed_up_with_url.erb +0 -5
- data/test/mail_helper_test.rb +0 -95
- data/test/mail_layout_test.rb +0 -123
- data/test/mail_render_test.rb +0 -116
- data/test/mail_service_test.rb +0 -1145
- data/test/quoting_test.rb +0 -105
- data/test/test_helper_test.rb +0 -129
- data/test/tmail_test.rb +0 -22
- data/test/url_test.rb +0 -76
data/lib/action_mailer/part.rb
DELETED
@@ -1,107 +0,0 @@
|
|
1
|
-
module ActionMailer
|
2
|
-
# Represents a subpart of an email message. It shares many similar
|
3
|
-
# attributes of ActionMailer::Base. Although you can create parts manually
|
4
|
-
# and add them to the +parts+ list of the mailer, it is easier
|
5
|
-
# to use the helper methods in ActionMailer::PartContainer.
|
6
|
-
class Part
|
7
|
-
include AdvAttrAccessor, PartContainer, Utils
|
8
|
-
|
9
|
-
# Represents the body of the part, as a string. This should not be a
|
10
|
-
# Hash (like ActionMailer::Base), but if you want a template to be rendered
|
11
|
-
# into the body of a subpart you can do it with the mailer's +render+ method
|
12
|
-
# and assign the result here.
|
13
|
-
adv_attr_accessor :body
|
14
|
-
|
15
|
-
# Specify the charset for this subpart. By default, it will be the charset
|
16
|
-
# of the containing part or mailer.
|
17
|
-
adv_attr_accessor :charset
|
18
|
-
|
19
|
-
# The content disposition of this part, typically either "inline" or
|
20
|
-
# "attachment".
|
21
|
-
adv_attr_accessor :content_disposition
|
22
|
-
|
23
|
-
# The content type of the part.
|
24
|
-
adv_attr_accessor :content_type
|
25
|
-
|
26
|
-
# The filename to use for this subpart (usually for attachments).
|
27
|
-
adv_attr_accessor :filename
|
28
|
-
|
29
|
-
# Accessor for specifying additional headers to include with this part.
|
30
|
-
adv_attr_accessor :headers
|
31
|
-
|
32
|
-
# The transfer encoding to use for this subpart, like "base64" or
|
33
|
-
# "quoted-printable".
|
34
|
-
adv_attr_accessor :transfer_encoding
|
35
|
-
|
36
|
-
# Create a new part from the given +params+ hash. The valid params keys
|
37
|
-
# correspond to the accessors.
|
38
|
-
def initialize(params)
|
39
|
-
@content_type = params[:content_type]
|
40
|
-
@content_disposition = params[:disposition] || "inline"
|
41
|
-
@charset = params[:charset]
|
42
|
-
@body = params[:body]
|
43
|
-
@filename = params[:filename]
|
44
|
-
@transfer_encoding = params[:transfer_encoding] || "quoted-printable"
|
45
|
-
@headers = params[:headers] || {}
|
46
|
-
@parts = []
|
47
|
-
end
|
48
|
-
|
49
|
-
# Convert the part to a mail object which can be included in the parts
|
50
|
-
# list of another mail object.
|
51
|
-
def to_mail(defaults)
|
52
|
-
part = TMail::Mail.new
|
53
|
-
|
54
|
-
real_content_type, ctype_attrs = parse_content_type(defaults)
|
55
|
-
|
56
|
-
if @parts.empty?
|
57
|
-
part.content_transfer_encoding = transfer_encoding || "quoted-printable"
|
58
|
-
case (transfer_encoding || "").downcase
|
59
|
-
when "base64" then
|
60
|
-
part.body = TMail::Base64.folding_encode(body)
|
61
|
-
when "quoted-printable"
|
62
|
-
part.body = [normalize_new_lines(body)].pack("M*")
|
63
|
-
else
|
64
|
-
part.body = body
|
65
|
-
end
|
66
|
-
|
67
|
-
# Always set the content_type after setting the body and or parts!
|
68
|
-
# Also don't set filename and name when there is none (like in
|
69
|
-
# non-attachment parts)
|
70
|
-
if content_disposition == "attachment"
|
71
|
-
ctype_attrs.delete "charset"
|
72
|
-
part.set_content_type(real_content_type, nil,
|
73
|
-
squish("name" => filename).merge(ctype_attrs))
|
74
|
-
part.set_content_disposition(content_disposition,
|
75
|
-
squish("filename" => filename).merge(ctype_attrs))
|
76
|
-
else
|
77
|
-
part.set_content_type(real_content_type, nil, ctype_attrs)
|
78
|
-
part.set_content_disposition(content_disposition)
|
79
|
-
end
|
80
|
-
else
|
81
|
-
if String === body
|
82
|
-
@parts.unshift Part.new(:charset => charset, :body => @body, :content_type => 'text/plain')
|
83
|
-
@body = nil
|
84
|
-
end
|
85
|
-
|
86
|
-
@parts.each do |p|
|
87
|
-
prt = (TMail::Mail === p ? p : p.to_mail(defaults))
|
88
|
-
part.parts << prt
|
89
|
-
end
|
90
|
-
|
91
|
-
if real_content_type =~ /multipart/
|
92
|
-
ctype_attrs.delete 'charset'
|
93
|
-
part.set_content_type(real_content_type, nil, ctype_attrs)
|
94
|
-
end
|
95
|
-
end
|
96
|
-
|
97
|
-
headers.each { |k,v| part[k] = v }
|
98
|
-
|
99
|
-
part
|
100
|
-
end
|
101
|
-
|
102
|
-
private
|
103
|
-
def squish(values={})
|
104
|
-
values.delete_if { |k,v| v.nil? }
|
105
|
-
end
|
106
|
-
end
|
107
|
-
end
|
@@ -1,55 +0,0 @@
|
|
1
|
-
module ActionMailer
|
2
|
-
# Accessors and helpers that ActionMailer::Base and ActionMailer::Part have
|
3
|
-
# in common. Using these helpers you can easily add subparts or attachments
|
4
|
-
# to your message:
|
5
|
-
#
|
6
|
-
# def my_mail_message(...)
|
7
|
-
# ...
|
8
|
-
# part "text/plain" do |p|
|
9
|
-
# p.body "hello, world"
|
10
|
-
# p.transfer_encoding "base64"
|
11
|
-
# end
|
12
|
-
#
|
13
|
-
# attachment "image/jpg" do |a|
|
14
|
-
# a.body = File.read("hello.jpg")
|
15
|
-
# a.filename = "hello.jpg"
|
16
|
-
# end
|
17
|
-
# end
|
18
|
-
module PartContainer
|
19
|
-
# The list of subparts of this container
|
20
|
-
attr_reader :parts
|
21
|
-
|
22
|
-
# Add a part to a multipart message, with the given content-type. The
|
23
|
-
# part itself is yielded to the block so that other properties (charset,
|
24
|
-
# body, headers, etc.) can be set on it.
|
25
|
-
def part(params)
|
26
|
-
params = {:content_type => params} if String === params
|
27
|
-
part = Part.new(params)
|
28
|
-
yield part if block_given?
|
29
|
-
@parts << part
|
30
|
-
end
|
31
|
-
|
32
|
-
# Add an attachment to a multipart message. This is simply a part with the
|
33
|
-
# content-disposition set to "attachment".
|
34
|
-
def attachment(params, &block)
|
35
|
-
params = { :content_type => params } if String === params
|
36
|
-
params = { :disposition => "attachment",
|
37
|
-
:transfer_encoding => "base64" }.merge(params)
|
38
|
-
part(params, &block)
|
39
|
-
end
|
40
|
-
|
41
|
-
private
|
42
|
-
|
43
|
-
def parse_content_type(defaults=nil)
|
44
|
-
if content_type.blank?
|
45
|
-
return defaults ?
|
46
|
-
[ defaults.content_type, { 'charset' => defaults.charset } ] :
|
47
|
-
[ nil, {} ]
|
48
|
-
end
|
49
|
-
ctype, *attrs = content_type.split(/;\s*/)
|
50
|
-
attrs = attrs.inject({}) { |h,s| k,v = s.split(/=/, 2); h[k] = v; h }
|
51
|
-
[ctype, {"charset" => charset || defaults && defaults.charset}.merge(attrs)]
|
52
|
-
end
|
53
|
-
|
54
|
-
end
|
55
|
-
end
|