actionmailer_csi 2.3.5.p6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (109) hide show
  1. data/CHANGELOG +370 -0
  2. data/MIT-LICENSE +21 -0
  3. data/README +149 -0
  4. data/Rakefile +99 -0
  5. data/install.rb +30 -0
  6. data/lib/action_mailer/adv_attr_accessor.rb +30 -0
  7. data/lib/action_mailer/base.rb +706 -0
  8. data/lib/action_mailer/helpers.rb +113 -0
  9. data/lib/action_mailer/mail_helper.rb +17 -0
  10. data/lib/action_mailer/part.rb +107 -0
  11. data/lib/action_mailer/part_container.rb +55 -0
  12. data/lib/action_mailer/quoting.rb +61 -0
  13. data/lib/action_mailer/test_case.rb +64 -0
  14. data/lib/action_mailer/test_helper.rb +68 -0
  15. data/lib/action_mailer/utils.rb +7 -0
  16. data/lib/action_mailer/vendor/text-format-0.6.3/text/format.rb +1466 -0
  17. data/lib/action_mailer/vendor/text_format.rb +10 -0
  18. data/lib/action_mailer/vendor/tmail-1.2.3/tmail/address.rb +426 -0
  19. data/lib/action_mailer/vendor/tmail-1.2.3/tmail/attachments.rb +46 -0
  20. data/lib/action_mailer/vendor/tmail-1.2.3/tmail/base64.rb +46 -0
  21. data/lib/action_mailer/vendor/tmail-1.2.3/tmail/compat.rb +41 -0
  22. data/lib/action_mailer/vendor/tmail-1.2.3/tmail/config.rb +67 -0
  23. data/lib/action_mailer/vendor/tmail-1.2.3/tmail/core_extensions.rb +63 -0
  24. data/lib/action_mailer/vendor/tmail-1.2.3/tmail/encode.rb +581 -0
  25. data/lib/action_mailer/vendor/tmail-1.2.3/tmail/header.rb +960 -0
  26. data/lib/action_mailer/vendor/tmail-1.2.3/tmail/index.rb +9 -0
  27. data/lib/action_mailer/vendor/tmail-1.2.3/tmail/interface.rb +1130 -0
  28. data/lib/action_mailer/vendor/tmail-1.2.3/tmail/loader.rb +3 -0
  29. data/lib/action_mailer/vendor/tmail-1.2.3/tmail/mail.rb +578 -0
  30. data/lib/action_mailer/vendor/tmail-1.2.3/tmail/mailbox.rb +495 -0
  31. data/lib/action_mailer/vendor/tmail-1.2.3/tmail/main.rb +6 -0
  32. data/lib/action_mailer/vendor/tmail-1.2.3/tmail/mbox.rb +3 -0
  33. data/lib/action_mailer/vendor/tmail-1.2.3/tmail/net.rb +248 -0
  34. data/lib/action_mailer/vendor/tmail-1.2.3/tmail/obsolete.rb +132 -0
  35. data/lib/action_mailer/vendor/tmail-1.2.3/tmail/parser.rb +1478 -0
  36. data/lib/action_mailer/vendor/tmail-1.2.3/tmail/port.rb +379 -0
  37. data/lib/action_mailer/vendor/tmail-1.2.3/tmail/quoting.rb +118 -0
  38. data/lib/action_mailer/vendor/tmail-1.2.3/tmail/require_arch.rb +58 -0
  39. data/lib/action_mailer/vendor/tmail-1.2.3/tmail/scanner.rb +49 -0
  40. data/lib/action_mailer/vendor/tmail-1.2.3/tmail/scanner_r.rb +261 -0
  41. data/lib/action_mailer/vendor/tmail-1.2.3/tmail/stringio.rb +280 -0
  42. data/lib/action_mailer/vendor/tmail-1.2.3/tmail/utils.rb +337 -0
  43. data/lib/action_mailer/vendor/tmail-1.2.3/tmail/version.rb +39 -0
  44. data/lib/action_mailer/vendor/tmail-1.2.3/tmail.rb +5 -0
  45. data/lib/action_mailer/vendor/tmail.rb +17 -0
  46. data/lib/action_mailer/version.rb +9 -0
  47. data/lib/action_mailer.rb +62 -0
  48. data/lib/actionmailer.rb +2 -0
  49. data/test/abstract_unit.rb +62 -0
  50. data/test/asset_host_test.rb +54 -0
  51. data/test/delivery_method_test.rb +51 -0
  52. data/test/fixtures/asset_host_mailer/email_with_asset.html.erb +1 -0
  53. data/test/fixtures/auto_layout_mailer/hello.html.erb +1 -0
  54. data/test/fixtures/auto_layout_mailer/multipart.text.html.erb +1 -0
  55. data/test/fixtures/auto_layout_mailer/multipart.text.plain.erb +1 -0
  56. data/test/fixtures/explicit_layout_mailer/logout.html.erb +1 -0
  57. data/test/fixtures/explicit_layout_mailer/signup.html.erb +1 -0
  58. data/test/fixtures/first_mailer/share.erb +1 -0
  59. data/test/fixtures/helper_mailer/use_example_helper.erb +1 -0
  60. data/test/fixtures/helper_mailer/use_helper.erb +1 -0
  61. data/test/fixtures/helper_mailer/use_helper_method.erb +1 -0
  62. data/test/fixtures/helper_mailer/use_mail_helper.erb +5 -0
  63. data/test/fixtures/helpers/example_helper.rb +5 -0
  64. data/test/fixtures/layouts/auto_layout_mailer.html.erb +1 -0
  65. data/test/fixtures/layouts/auto_layout_mailer.text.erb +1 -0
  66. data/test/fixtures/layouts/spam.html.erb +1 -0
  67. data/test/fixtures/path.with.dots/funky_path_mailer/multipart_with_template_path_with_dots.erb +1 -0
  68. data/test/fixtures/raw_email +14 -0
  69. data/test/fixtures/raw_email10 +20 -0
  70. data/test/fixtures/raw_email12 +32 -0
  71. data/test/fixtures/raw_email13 +29 -0
  72. data/test/fixtures/raw_email2 +114 -0
  73. data/test/fixtures/raw_email3 +70 -0
  74. data/test/fixtures/raw_email4 +59 -0
  75. data/test/fixtures/raw_email5 +19 -0
  76. data/test/fixtures/raw_email6 +20 -0
  77. data/test/fixtures/raw_email7 +66 -0
  78. data/test/fixtures/raw_email8 +47 -0
  79. data/test/fixtures/raw_email9 +28 -0
  80. data/test/fixtures/raw_email_quoted_with_0d0a +14 -0
  81. data/test/fixtures/raw_email_with_invalid_characters_in_content_type +104 -0
  82. data/test/fixtures/raw_email_with_nested_attachment +100 -0
  83. data/test/fixtures/raw_email_with_partially_quoted_subject +14 -0
  84. data/test/fixtures/second_mailer/share.erb +1 -0
  85. data/test/fixtures/templates/signed_up.erb +3 -0
  86. data/test/fixtures/test_mailer/_subtemplate.text.plain.erb +1 -0
  87. data/test/fixtures/test_mailer/body_ivar.erb +2 -0
  88. data/test/fixtures/test_mailer/custom_templating_extension.text.html.haml +6 -0
  89. data/test/fixtures/test_mailer/custom_templating_extension.text.plain.haml +6 -0
  90. data/test/fixtures/test_mailer/implicitly_multipart_example.ignored.erb +1 -0
  91. data/test/fixtures/test_mailer/implicitly_multipart_example.rhtml.bak +1 -0
  92. data/test/fixtures/test_mailer/implicitly_multipart_example.text.html.erb +10 -0
  93. data/test/fixtures/test_mailer/implicitly_multipart_example.text.html.erb~ +10 -0
  94. data/test/fixtures/test_mailer/implicitly_multipart_example.text.plain.erb +2 -0
  95. data/test/fixtures/test_mailer/implicitly_multipart_example.text.yaml.erb +1 -0
  96. data/test/fixtures/test_mailer/included_subtemplate.text.plain.erb +1 -0
  97. data/test/fixtures/test_mailer/rxml_template.builder +2 -0
  98. data/test/fixtures/test_mailer/rxml_template.rxml +2 -0
  99. data/test/fixtures/test_mailer/signed_up.html.erb +3 -0
  100. data/test/fixtures/test_mailer/signed_up_with_url.erb +5 -0
  101. data/test/mail_helper_test.rb +95 -0
  102. data/test/mail_layout_test.rb +123 -0
  103. data/test/mail_render_test.rb +116 -0
  104. data/test/mail_service_test.rb +1081 -0
  105. data/test/quoting_test.rb +99 -0
  106. data/test/test_helper_test.rb +129 -0
  107. data/test/tmail_test.rb +22 -0
  108. data/test/url_test.rb +76 -0
  109. metadata +195 -0
data/CHANGELOG ADDED
@@ -0,0 +1,370 @@
1
+ *2.3.5 (November 25, 2009)*
2
+
3
+ * Minor Bug Fixes and deprecation warnings
4
+
5
+ *2.3.4 (September 4, 2009)*
6
+
7
+ * Minor bug fixes.
8
+
9
+ *2.3.3 (July 12, 2009)*
10
+
11
+ * No changes, just a version bump.
12
+
13
+ *2.3.2 [Final] (March 15, 2009)*
14
+
15
+ * Fixed that ActionMailer should send correctly formatted Return-Path in MAIL FROM for SMTP #1842 [Matt Jones]
16
+
17
+ * Fixed RFC-2045 quoted-printable bug #1421 [squadette]
18
+
19
+ * Fixed that no body charset would be set when there are attachments present #740 [Paweł Kondzior]
20
+
21
+
22
+ *2.2.1 [RC2] (November 14th, 2008)*
23
+
24
+ * Turn on STARTTLS if it is available in Net::SMTP (added in Ruby 1.8.7) and the SMTP server supports it (This is required for Gmail's SMTP server) #1336 [Grant Hollingworth]
25
+
26
+
27
+ *2.2.0 [RC1] (October 24th, 2008)*
28
+
29
+ * Add layout functionality to mailers [Pratik Naik]
30
+
31
+ Mailer layouts behaves just like controller layouts, except layout names need to
32
+ have '_mailer' postfix for them to be automatically picked up.
33
+
34
+
35
+ *2.1.0 (May 31st, 2008)*
36
+
37
+ * Fixed that a return-path header would be ignored #7572 [joost]
38
+
39
+ * Less verbose mail logging: just recipients for :info log level; the whole email for :debug only. #8000 [iaddict, Tarmo Tänav]
40
+
41
+ * Updated TMail to version 1.2.1 [Mikel Lindsaar]
42
+
43
+ * Fixed that you don't have to call super in ActionMailer::TestCase#setup #10406 [jamesgolick]
44
+
45
+
46
+ *2.0.2* (December 16th, 2007)
47
+
48
+ * Included in Rails 2.0.2
49
+
50
+
51
+ *2.0.1* (December 7th, 2007)
52
+
53
+ * Update ActionMailer so it treats ActionView the same way that ActionController does. Closes #10244 [Rick Olson]
54
+
55
+ * Pass the template_root as an array as ActionView's view_path
56
+ * Request templates with the "#{mailer_name}/#{action}" as opposed to just "#{action}"
57
+
58
+ * Fixed that partials would be broken when using text.plain.erb as the extension #10130 [java]
59
+
60
+ * Update README to use new smtp settings configuration API. Closes #10060 [psq]
61
+
62
+ * Allow ActionMailer subclasses to individually set their delivery method (so two subclasses can have different delivery methods) #10033 [Zach Dennis]
63
+
64
+ * Update TMail to v1.1.0. Use an updated version of TMail if available. [Mikel Lindsaar]
65
+
66
+ * Introduce a new base test class for testing Mailers. ActionMailer::TestCase [Michael Koziarski]
67
+
68
+ * Fix silent failure of rxml templates. #9879 [jstewart]
69
+
70
+ * Fix attachment decoding when using the TMail C extension. #7861 [orangechicken]
71
+
72
+ * Increase mail delivery test coverage. #8692 [Kamal Fariz Mahyuddin]
73
+
74
+ * Register alternative template engines using ActionMailer::Base.register_template_extension('haml'). #7534 [cwd, Josh Peek]
75
+
76
+ * Only load ActionController::UrlWriter if ActionController is present [Rick Olson]
77
+
78
+ * Make sure parsed emails recognized attachments nested inside multipart parts. #6714 [Jamis Buck]
79
+
80
+ * Allow mailer actions named send by using __send__ internally. #6467 [iGEL]
81
+
82
+ * Add assert_emails and assert_no_emails to test the number of emails delivered. #6479 [Jonathan Viney]
83
+ # Assert total number of emails delivered:
84
+ assert_emails 0
85
+ ContactMailer.deliver_contact
86
+ assert_emails 1
87
+
88
+ # Assert number of emails delivered within a block:
89
+ assert_emails 1 do
90
+ post :signup, :name => 'Jonathan'
91
+ end
92
+
93
+
94
+ *1.3.3* (March 12th, 2007)
95
+
96
+ * Depend on Action Pack 1.13.3
97
+
98
+
99
+ *1.3.2* (February 5th, 2007)
100
+
101
+ * Deprecate server_settings renaming it to smtp_settings, add sendmail_settings to allow you to override the arguments to and location of the sendmail executable. [Michael Koziarski]
102
+
103
+
104
+ *1.3.1* (January 16th, 2007)
105
+
106
+ * Depend on Action Pack 1.13.1
107
+
108
+
109
+ *1.3.0* (January 16th, 2007)
110
+
111
+ * Make mime version default to 1.0. closes #2323 [ror@andreas-s.net]
112
+
113
+ * Make sure quoted-printable text is decoded correctly when only portions of the text are encoded. closes #3154. [jon@siliconcircus.com]
114
+
115
+ * Make sure DOS newlines in quoted-printable text are normalized to unix newlines before unquoting. closes #4166 and #4452. [Jamis Buck]
116
+
117
+ * Fixed that iconv decoding should catch InvalidEncoding #3153 [jon@siliconcircus.com]
118
+
119
+ * Tighten rescue clauses. #5985 [james@grayproductions.net]
120
+
121
+ * Automatically included ActionController::UrlWriter, such that URL generation can happen within ActionMailer controllers. [David Heinemeier Hansson]
122
+
123
+ * Replace Reloadable with Reloadable::Deprecated. [Nicholas Seckar]
124
+
125
+ * Mailer template root applies to a class and its subclasses rather than acting globally. #5555 [somekool@gmail.com]
126
+
127
+ * Resolve action naming collision. #5520 [ssinghi@kreeti.com]
128
+
129
+ * ActionMailer::Base documentation rewrite. Closes #4991 [Kevin Clark, Marcel Molina Jr.]
130
+
131
+ * Replace alias method chaining with Module#alias_method_chain. [Marcel Molina Jr.]
132
+
133
+ * Replace Ruby's deprecated append_features in favor of included. [Marcel Molina Jr.]
134
+
135
+ * Correct spurious documentation example code which results in a SyntaxError. [Marcel Molina Jr.]
136
+
137
+
138
+ *1.2.1* (April 6th, 2006)
139
+
140
+ * Be part of Rails 1.1.1
141
+
142
+
143
+ *1.2.0* (March 27th, 2006)
144
+
145
+ * Nil charset caused subject line to be improperly quoted in implicitly multipart messages #2662 [ehalvorsen+rails@runbox.com]
146
+
147
+ * Parse content-type apart before using it so that sub-parts of the header can be set correctly #2918 [Jamis Buck]
148
+
149
+ * Make custom headers work in subparts #4034 [elan@bluemandrill.com]
150
+
151
+ * Template paths with dot chars in them no longer mess up implicit template selection for multipart messages #3332 [Chad Fowler]
152
+
153
+ * Make sure anything with content-disposition of "attachment" is passed to the attachment presenter when parsing an email body [Jamis Buck]
154
+
155
+ * Make sure TMail#attachments includes anything with content-disposition of "attachment", regardless of content-type [Jamis Buck]
156
+
157
+
158
+ *1.1.5* (December 13th, 2005)
159
+
160
+ * Become part of Rails 1.0
161
+
162
+
163
+ *1.1.4* (December 7th, 2005)
164
+
165
+ * Rename Version constant to VERSION. #2802 [Marcel Molina Jr.]
166
+
167
+ * Stricter matching for implicitly multipart filenames excludes files ending in unsupported extensions (such as foo.rhtml.bak) and without a two-part content type (such as foo.text.rhtml or foo.text.really.plain.rhtml). #2398 [Dave Burt <dave@burt.id.au>, Jeremy Kemper]
168
+
169
+
170
+ *1.1.3* (November 7th, 2005)
171
+
172
+ * Allow Mailers to have custom initialize methods that set default instance variables for all mail actions #2563 [mrj@bigpond.net.au]
173
+
174
+
175
+ *1.1.2* (October 26th, 2005)
176
+
177
+ * Upgraded to Action Pack 1.10.2
178
+
179
+
180
+ *1.1.1* (October 19th, 2005)
181
+
182
+ * Upgraded to Action Pack 1.10.1
183
+
184
+
185
+ *1.1.0* (October 16th, 2005)
186
+
187
+ * Update and extend documentation (rdoc)
188
+
189
+ * Minero Aoki made TMail available to Rails/ActionMailer under the MIT license (instead of LGPL) [RubyConf '05]
190
+
191
+ * Austin Ziegler made Text::Simple available to Rails/ActionMailer under a MIT-like licens [See rails ML, subject "Text::Format Licence Exception" on Oct 15, 2005]
192
+
193
+ * Fix vendor require paths to prevent files being required twice
194
+
195
+ * Don't add charset to content-type header for a part that contains subparts (for AOL compatibility) #2013 [John Long]
196
+
197
+ * Preserve underscores when unquoting message bodies #1930
198
+
199
+ * Encode multibyte characters correctly #1894
200
+
201
+ * Multipart messages specify a MIME-Version header automatically #2003 [John Long]
202
+
203
+ * Add a unified render method to ActionMailer (delegates to ActionView::Base#render)
204
+
205
+ * Move mailer initialization to a separate (overridable) method, so that subclasses may alter the various defaults #1727
206
+
207
+ * Look at content-location header (if available) to determine filename of attachments #1670
208
+
209
+ * ActionMailer::Base.deliver(email) had been accidentally removed, but was documented in the Rails book #1849
210
+
211
+ * Fix problem with sendmail delivery where headers should be delimited by \n characters instead of \r\n, which confuses some mail readers #1742 [Kent Sibilev]
212
+
213
+
214
+ *1.0.1* (11 July, 2005)
215
+
216
+ * Bind to Action Pack 1.9.1
217
+
218
+
219
+ *1.0.0* (6 July, 2005)
220
+
221
+ * Avoid adding nil header values #1392
222
+
223
+ * Better multipart support with implicit multipart/alternative and sorting of subparts [John Long]
224
+
225
+ * Allow for nested parts in multipart mails #1570 [Flurin Egger]
226
+
227
+ * Normalize line endings in outgoing mail bodies to "\n" #1536 [John Long]
228
+
229
+ * Allow template to be explicitly specified #1448 [tuxie@dekadance.se]
230
+
231
+ * Allow specific "multipart/xxx" content-type to be set on multipart messages #1412 [Flurin Egger]
232
+
233
+ * Unquoted @ characters in headers are now accepted in spite of RFC 822 #1206
234
+
235
+ * Helper support (borrowed from ActionPack)
236
+
237
+ * Silently ignore Errno::EINVAL errors when converting text.
238
+
239
+ * Don't cause an error when parsing an encoded attachment name #1340 [lon@speedymac.com]
240
+
241
+ * Nested multipart message parts are correctly processed in TMail::Mail#body
242
+
243
+ * BCC headers are removed when sending via SMTP #1402
244
+
245
+ * Added 'content_type' accessor, to allow content type to be set on a per-message basis. content_type defaults to "text/plain".
246
+
247
+ * Silently ignore Iconv::IllegalSequence errors when converting text #1341 [lon@speedymac.com]
248
+
249
+ * Support attachments and multipart messages.
250
+
251
+ * Added new accessors for the various mail properties.
252
+
253
+ * Fix to only perform the charset conversion if a 'from' and a 'to' charset are given (make no assumptions about what the charset was) #1276 [Jamis Buck]
254
+
255
+ * Fix attachments and content-type problems #1276 [Jamis Buck]
256
+
257
+ * Fixed the TMail#body method to look at the content-transfer-encoding header and unquote the body according to the rules it specifies #1265 [Jamis Buck]
258
+
259
+ * Added unquoting even if the iconv lib can't be loaded--in that case, only the charset conversion is skipped #1265 [Jamis Buck]
260
+
261
+ * Added automatic decoding of base64 bodies #1214 [Jamis Buck]
262
+
263
+ * Added that delivery errors are caught in a way so the mail is still returned whether the delivery was successful or not
264
+
265
+ * Fixed that email address like "Jamis Buck, M.D." <wild.medicine@example.net> would cause the quoter to generate emails resulting in "bad address" errors from the mail server #1220 [Jamis Buck]
266
+
267
+
268
+ *0.9.1* (20th April, 2005)
269
+
270
+ * Depend on Action Pack 1.8.1
271
+
272
+
273
+ *0.9.0* (19th April, 2005)
274
+
275
+ * Added that deliver_* will now return the email that was sent
276
+
277
+ * Added that quoting to UTF-8 only happens if the characters used are in that range #955 [Jamis Buck]
278
+
279
+ * Fixed quoting for all address headers, not just to #955 [Jamis Buck]
280
+
281
+ * Fixed unquoting of emails that doesn't have an explicit charset #1036 [wolfgang@stufenlos.net]
282
+
283
+
284
+ *0.8.1* (27th March, 2005)
285
+
286
+ * Fixed that if charset was found that the end of a mime part declaration TMail would throw an error #919 [lon@speedymac.com]
287
+
288
+ * Fixed that TMail::Unquoter would fail to recognize quoting method if it was in lowercase #919 [lon@speedymac.com]
289
+
290
+ * Fixed that TMail::Encoder would fail when it attempts to parse e-mail addresses which are encoded using something other than the messages encoding method #919 [lon@speedymac.com]
291
+
292
+ * Added rescue for missing iconv library and throws warnings if subject/body is called on a TMail object without it instead
293
+
294
+
295
+ *0.8.0* (22th March, 2005)
296
+
297
+ * Added framework support for processing incoming emails with an Action Mailer class. See example in README.
298
+
299
+
300
+ *0.7.1* (7th March, 2005)
301
+
302
+ * Bind to newest Action Pack (1.5.1)
303
+
304
+
305
+ *0.7.0* (24th February, 2005)
306
+
307
+ * Added support for charsets for both subject and body. The default charset is now UTF-8 #673 [Jamis Buck]. Examples:
308
+
309
+ def iso_charset(recipient)
310
+ @recipients = recipient
311
+ @subject = "testing iso charsets"
312
+ @from = "system@loudthinking.com"
313
+ @body = "Nothing to see here."
314
+ @charset = "iso-8859-1"
315
+ end
316
+
317
+ def unencoded_subject(recipient)
318
+ @recipients = recipient
319
+ @subject = "testing unencoded subject"
320
+ @from = "system@loudthinking.com"
321
+ @body = "Nothing to see here."
322
+ @encode_subject = false
323
+ @charset = "iso-8859-1"
324
+ end
325
+
326
+
327
+ *0.6.1* (January 18th, 2005)
328
+
329
+ * Fixed sending of emails to use Tmail#from not the deprecated Tmail#from_address
330
+
331
+
332
+ *0.6* (January 17th, 2005)
333
+
334
+ * Fixed that bcc and cc should be settable through @bcc and @cc -- not just @headers["Bcc"] and @headers["Cc"] #453 [Eric Hodel]
335
+
336
+ * Fixed Action Mailer to be "warnings safe" so you can run with ruby -w and not get framework warnings #453 [Eric Hodel]
337
+
338
+
339
+ *0.5*
340
+
341
+ * Added access to custom headers, like cc, bcc, and reply-to #268 [Andreas Schwarz]. Example:
342
+
343
+ def post_notification(recipients, post)
344
+ @recipients = recipients
345
+ @from = post.author.email_address_with_name
346
+ @headers["bcc"] = SYSTEM_ADMINISTRATOR_EMAIL
347
+ @headers["reply-to"] = "notifications@example.com"
348
+ @subject = "[#{post.account.name} #{post.title}]"
349
+ @body["post"] = post
350
+ end
351
+
352
+ *0.4* (5)
353
+
354
+ * Consolidated the server configuration options into Base#server_settings= and expanded that with controls for authentication and more [Marten]
355
+ NOTE: This is an API change that could potentially break your application if you used the old application form. Please do change!
356
+
357
+ * Added Base#deliveries as an accessor for an array of emails sent out through that ActionMailer class when using the :test delivery option. [Jeremy Kemper]
358
+
359
+ * Added Base#perform_deliveries= which can be set to false to turn off the actual delivery of the email through smtp or sendmail.
360
+ This is especially useful for functional testing that shouldn't send off real emails, but still trigger delivery_* methods.
361
+
362
+ * Added option to specify delivery method with Base#delivery_method=. Default is :smtp and :sendmail is currently the only other option.
363
+ Sendmail is assumed to be present at "/usr/sbin/sendmail" if that option is used. [Kent Sibilev]
364
+
365
+ * Dropped "include TMail" as it added to much baggage into the default namespace (like Version) [Chad Fowler]
366
+
367
+
368
+ *0.3*
369
+
370
+ * First release
data/MIT-LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ Copyright (c) 2004-2009 David Heinemeier Hansson
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21
+
data/README ADDED
@@ -0,0 +1,149 @@
1
+ = Action Mailer -- Easy email delivery and testing
2
+
3
+ Action Mailer is a framework for designing email-service layers. These layers
4
+ are used to consolidate code for sending out forgotten passwords, welcome
5
+ wishes on signup, invoices for billing, and any other use case that requires
6
+ a written notification to either a person or another system.
7
+
8
+ Additionally, an Action Mailer class can be used to process incoming email,
9
+ such as allowing a weblog to accept new posts from an email (which could even
10
+ have been sent from a phone).
11
+
12
+ == Sending emails
13
+
14
+ The framework works by setting up all the email details, except the body,
15
+ in methods on the service layer. Subject, recipients, sender, and timestamp
16
+ are all set up this way. An example of such a method:
17
+
18
+ def signed_up(recipient)
19
+ recipients recipient
20
+ subject "[Signed up] Welcome #{recipient}"
21
+ from "system@loudthinking.com"
22
+ body :recipient => recipient
23
+ end
24
+
25
+ The body of the email is created by using an Action View template (regular
26
+ ERb) that has the content of the body hash parameter available as instance variables.
27
+ So the corresponding body template for the method above could look like this:
28
+
29
+ Hello there,
30
+
31
+ Mr. <%= @recipient %>
32
+
33
+ And if the recipient was given as "david@loudthinking.com", the email
34
+ generated would look like this:
35
+
36
+ Date: Sun, 12 Dec 2004 00:00:00 +0100
37
+ From: system@loudthinking.com
38
+ To: david@loudthinking.com
39
+ Subject: [Signed up] Welcome david@loudthinking.com
40
+
41
+ Hello there,
42
+
43
+ Mr. david@loudthinking.com
44
+
45
+ You never actually call the instance methods like signed_up directly. Instead,
46
+ you call class methods like deliver_* and create_* that are automatically
47
+ created for each instance method. So if the signed_up method sat on
48
+ ApplicationMailer, it would look like this:
49
+
50
+ ApplicationMailer.create_signed_up("david@loudthinking.com") # => tmail object for testing
51
+ ApplicationMailer.deliver_signed_up("david@loudthinking.com") # sends the email
52
+ ApplicationMailer.new.signed_up("david@loudthinking.com") # won't work!
53
+
54
+ == Receiving emails
55
+
56
+ To receive emails, you need to implement a public instance method called receive that takes a
57
+ tmail object as its single parameter. The Action Mailer framework has a corresponding class method,
58
+ which is also called receive, that accepts a raw, unprocessed email as a string, which it then turns
59
+ into the tmail object and calls the receive instance method.
60
+
61
+ Example:
62
+
63
+ class Mailman < ActionMailer::Base
64
+ def receive(email)
65
+ page = Page.find_by_address(email.to.first)
66
+ page.emails.create(
67
+ :subject => email.subject, :body => email.body
68
+ )
69
+
70
+ if email.has_attachments?
71
+ for attachment in email.attachments
72
+ page.attachments.create({
73
+ :file => attachment, :description => email.subject
74
+ })
75
+ end
76
+ end
77
+ end
78
+ end
79
+
80
+ This Mailman can be the target for Postfix or other MTAs. In Rails, you would use the runner in the
81
+ trivial case like this:
82
+
83
+ ./script/runner 'Mailman.receive(STDIN.read)'
84
+
85
+ However, invoking Rails in the runner for each mail to be received is very resource intensive. A single
86
+ instance of Rails should be run within a daemon if it is going to be utilized to process more than just
87
+ a limited number of email.
88
+
89
+ == Configuration
90
+
91
+ The Base class has the full list of configuration options. Here's an example:
92
+
93
+ ActionMailer::Base.smtp_settings = {
94
+ :address => 'smtp.yourserver.com', # default: localhost
95
+ :port => '25', # default: 25
96
+ :user_name => 'user',
97
+ :password => 'pass',
98
+ :authentication => :plain # :plain, :login or :cram_md5
99
+ }
100
+
101
+ == Dependencies
102
+
103
+ Action Mailer requires that the Action Pack is either available to be required immediately
104
+ or is accessible as a GEM.
105
+
106
+
107
+ == Bundled software
108
+
109
+ * tmail 0.10.8 by Minero Aoki released under LGPL
110
+ Read more on http://i.loveruby.net/en/prog/tmail.html
111
+
112
+ * Text::Format 0.63 by Austin Ziegler released under OpenSource
113
+ Read more on http://www.halostatue.ca/ruby/Text__Format.html
114
+
115
+
116
+ == Download
117
+
118
+ The latest version of Action Mailer can be found at
119
+
120
+ * http://rubyforge.org/project/showfiles.php?group_id=361
121
+
122
+ Documentation can be found at
123
+
124
+ * http://actionmailer.rubyonrails.org
125
+
126
+
127
+ == Installation
128
+
129
+ You can install Action Mailer with the following command.
130
+
131
+ % [sudo] ruby install.rb
132
+
133
+ from its distribution directory.
134
+
135
+
136
+ == License
137
+
138
+ Action Mailer is released under the MIT license.
139
+
140
+
141
+ == Support
142
+
143
+ The Action Mailer homepage is http://www.rubyonrails.org. You can find
144
+ the Action Mailer RubyForge page at http://rubyforge.org/projects/actionmailer.
145
+ And as Jim from Rake says:
146
+
147
+ Feel free to submit commits or feature requests. If you send a patch,
148
+ remember to update the corresponding unit tests. If fact, I prefer
149
+ new feature to be submitted in the form of new unit tests.
data/Rakefile ADDED
@@ -0,0 +1,99 @@
1
+ require 'rubygems'
2
+ require 'rake'
3
+ require 'rake/testtask'
4
+ require 'rake/rdoctask'
5
+ require 'rake/packagetask'
6
+ require 'rake/gempackagetask'
7
+ require File.join(File.dirname(__FILE__), 'lib', 'action_mailer', 'version')
8
+
9
+ PKG_BUILD = ENV['PKG_BUILD'] ? '.' + ENV['PKG_BUILD'] : ''
10
+ PKG_NAME = 'actionmailer_csi'
11
+ PKG_VERSION = ActionMailer::VERSION::STRING + PKG_BUILD
12
+ PKG_FILE_NAME = "#{PKG_NAME}-#{PKG_VERSION}"
13
+
14
+ RELEASE_NAME = "REL #{PKG_VERSION}"
15
+
16
+ RUBY_FORGE_PROJECT = "actionmailer"
17
+ RUBY_FORGE_USER = "webster132"
18
+
19
+ desc "Default Task"
20
+ task :default => [ :test ]
21
+
22
+ # Run the unit tests
23
+ Rake::TestTask.new { |t|
24
+ t.libs << "test"
25
+ t.pattern = 'test/*_test.rb'
26
+ t.verbose = true
27
+ t.warning = false
28
+ }
29
+
30
+
31
+ # Generate the RDoc documentation
32
+ Rake::RDocTask.new { |rdoc|
33
+ rdoc.rdoc_dir = 'doc'
34
+ rdoc.title = "Action Mailer -- Easy email delivery and testing"
35
+ rdoc.options << '--line-numbers' << '--inline-source' << '-A cattr_accessor=object'
36
+ rdoc.options << '--charset' << 'utf-8'
37
+ rdoc.template = ENV['template'] ? "#{ENV['template']}.rb" : '../doc/template/horo'
38
+ rdoc.rdoc_files.include('README', 'CHANGELOG')
39
+ rdoc.rdoc_files.include('lib/action_mailer.rb')
40
+ rdoc.rdoc_files.include('lib/action_mailer/*.rb')
41
+ }
42
+
43
+
44
+ # Create compressed packages
45
+ spec = Gem::Specification.new do |s|
46
+ s.platform = Gem::Platform::RUBY
47
+ s.name = PKG_NAME
48
+ s.summary = "Service layer for easy email delivery and testing."
49
+ s.description = %q{Makes it trivial to test and deliver emails sent from a single service layer.}
50
+ s.version = PKG_VERSION
51
+
52
+ s.author = "David Heinemeier Hansson"
53
+ s.email = "david@loudthinking.com"
54
+ s.rubyforge_project = "actionmailer"
55
+ s.homepage = "http://www.rubyonrails.org"
56
+
57
+ s.add_dependency('actionpack', '= 2.3.5' + PKG_BUILD)
58
+
59
+ s.has_rdoc = true
60
+ s.requirements << 'none'
61
+ s.require_path = 'lib'
62
+ s.autorequire = 'action_mailer'
63
+
64
+ s.files = [ "Rakefile", "install.rb", "README", "CHANGELOG", "MIT-LICENSE" ]
65
+ s.files = s.files + Dir.glob( "lib/**/*" ).delete_if { |item| item.include?( "\.svn" ) }
66
+ s.files = s.files + Dir.glob( "test/**/*" ).delete_if { |item| item.include?( "\.svn" ) }
67
+ end
68
+
69
+ Rake::GemPackageTask.new(spec) do |p|
70
+ p.gem_spec = spec
71
+ p.need_tar = true
72
+ p.need_zip = true
73
+ end
74
+
75
+
76
+ desc "Publish the API documentation"
77
+ task :pgem => [:package] do
78
+ require 'rake/contrib/sshpublisher'
79
+ Rake::SshFilePublisher.new("gems.rubyonrails.org", "/u/sites/gems/gems", "pkg", "#{PKG_FILE_NAME}.gem").upload
80
+ `ssh gems.rubyonrails.org '/u/sites/gems/gemupdate.sh'`
81
+ end
82
+
83
+ desc "Publish the API documentation"
84
+ task :pdoc => [:rdoc] do
85
+ require 'rake/contrib/sshpublisher'
86
+ Rake::SshDirPublisher.new("wrath.rubyonrails.org", "public_html/am", "doc").upload
87
+ end
88
+
89
+ desc "Publish the release files to RubyForge."
90
+ task :release => [ :package ] do
91
+ require 'rubyforge'
92
+ require 'rake/contrib/rubyforgepublisher'
93
+
94
+ packages = %w( gem tgz zip ).collect{ |ext| "pkg/#{PKG_NAME}-#{PKG_VERSION}.#{ext}" }
95
+
96
+ rubyforge = RubyForge.new
97
+ rubyforge.login
98
+ rubyforge.add_release(PKG_NAME, PKG_NAME, "REL #{PKG_VERSION}", *packages)
99
+ end
data/install.rb ADDED
@@ -0,0 +1,30 @@
1
+ require 'rbconfig'
2
+ require 'find'
3
+ require 'ftools'
4
+
5
+ include Config
6
+
7
+ # this was adapted from rdoc's install.rb by way of Log4r
8
+
9
+ $sitedir = CONFIG["sitelibdir"]
10
+ unless $sitedir
11
+ version = CONFIG["MAJOR"] + "." + CONFIG["MINOR"]
12
+ $libdir = File.join(CONFIG["libdir"], "ruby", version)
13
+ $sitedir = $:.find {|x| x =~ /site_ruby/ }
14
+ if !$sitedir
15
+ $sitedir = File.join($libdir, "site_ruby")
16
+ elsif $sitedir !~ Regexp.quote(version)
17
+ $sitedir = File.join($sitedir, version)
18
+ end
19
+ end
20
+
21
+ # the actual gruntwork
22
+ Dir.chdir("lib")
23
+
24
+ Find.find("action_mailer", "action_mailer.rb") { |f|
25
+ if f[-3..-1] == ".rb"
26
+ File::install(f, File.join($sitedir, *f.split(/\//)), 0644, true)
27
+ else
28
+ File::makedirs(File.join($sitedir, *f.split(/\//)))
29
+ end
30
+ }
@@ -0,0 +1,30 @@
1
+ module ActionMailer
2
+ module AdvAttrAccessor #:nodoc:
3
+ def self.included(base)
4
+ base.extend(ClassMethods)
5
+ end
6
+
7
+ module ClassMethods #:nodoc:
8
+ def adv_attr_accessor(*names)
9
+ names.each do |name|
10
+ ivar = "@#{name}"
11
+
12
+ define_method("#{name}=") do |value|
13
+ instance_variable_set(ivar, value)
14
+ end
15
+
16
+ define_method(name) do |*parameters|
17
+ raise ArgumentError, "expected 0 or 1 parameters" unless parameters.length <= 1
18
+ if parameters.empty?
19
+ if instance_variable_names.include?(ivar)
20
+ instance_variable_get(ivar)
21
+ end
22
+ else
23
+ instance_variable_set(ivar, parameters.first)
24
+ end
25
+ end
26
+ end
27
+ end
28
+ end
29
+ end
30
+ end