aboutsummaryrefslogtreecommitdiffstats
path: root/actionmailer
diff options
context:
space:
mode:
Diffstat (limited to 'actionmailer')
-rw-r--r--actionmailer/README.rdoc11
-rw-r--r--actionmailer/lib/action_mailer/base.rb2
-rw-r--r--actionmailer/lib/action_mailer/mail_helper.rb13
-rw-r--r--actionmailer/lib/rails/generators/mailer/USAGE5
-rw-r--r--actionmailer/test/base_test.rb4
-rw-r--r--actionmailer/test/mail_helper_test.rb13
6 files changed, 36 insertions, 12 deletions
diff --git a/actionmailer/README.rdoc b/actionmailer/README.rdoc
index b346bd9e79..0fa18d751b 100644
--- a/actionmailer/README.rdoc
+++ b/actionmailer/README.rdoc
@@ -74,10 +74,10 @@ Or you can just chain the methods together like:
== Receiving emails
-To receive emails, you need to implement a public instance method called <tt>receive</tt> that takes a
-tmail object as its single parameter. The Action Mailer framework has a corresponding class method,
+To receive emails, you need to implement a public instance method called <tt>receive</tt> that takes an
+email object as its single parameter. The Action Mailer framework has a corresponding class method,
which is also called <tt>receive</tt>, that accepts a raw, unprocessed email as a string, which it then turns
-into the tmail object and calls the receive instance method.
+into the email object and calls the receive instance method.
Example:
@@ -104,7 +104,7 @@ trivial case like this:
rails runner 'Mailman.receive(STDIN.read)'
However, invoking Rails in the runner for each mail to be received is very resource intensive. A single
-instance of Rails should be run within a daemon if it is going to be utilized to process more than just
+instance of Rails should be run within a daemon, if it is going to be utilized to process more than just
a limited number of email.
== Configuration
@@ -128,7 +128,7 @@ The latest version of Action Mailer can be installed with Rubygems:
Source code can be downloaded as part of the Rails project on GitHub
-* http://github.com/rails/rails/tree/master/actionmailer/
+* https://github.com/rails/rails/tree/master/actionmailer/
== License
@@ -145,3 +145,4 @@ API documentation is at
Bug reports and feature requests can be filed with the rest for the Ruby on Rails project here:
* https://rails.lighthouseapp.com/projects/8994-ruby-on-rails/tickets
+
diff --git a/actionmailer/lib/action_mailer/base.rb b/actionmailer/lib/action_mailer/base.rb
index 15b0d01154..16fcf112b7 100644
--- a/actionmailer/lib/action_mailer/base.rb
+++ b/actionmailer/lib/action_mailer/base.rb
@@ -291,7 +291,7 @@ module ActionMailer #:nodoc:
# * <tt>:authentication</tt> - If your mail server requires authentication, you need to specify the
# authentication type here.
# This is a symbol and one of <tt>:plain</tt> (will send the password in the clear), <tt>:login</tt> (will
- # send password BASE64 encoded) or <tt>:cram_md5</tt> (combines a Challenge/Response mechanism to exchange
+ # send password Base64 encoded) or <tt>:cram_md5</tt> (combines a Challenge/Response mechanism to exchange
# information and a cryptographic Message Digest 5 algorithm to hash important information)
# * <tt>:enable_starttls_auto</tt> - When set to true, detects if STARTTLS is enabled in your SMTP server
# and starts to use it.
diff --git a/actionmailer/lib/action_mailer/mail_helper.rb b/actionmailer/lib/action_mailer/mail_helper.rb
index 887c7012d9..6f22adc479 100644
--- a/actionmailer/lib/action_mailer/mail_helper.rb
+++ b/actionmailer/lib/action_mailer/mail_helper.rb
@@ -4,7 +4,7 @@ module ActionMailer
# each line, and wrapped at 72 columns.
def block_format(text)
formatted = text.split(/\n\r\n/).collect { |paragraph|
- simple_format(paragraph)
+ format_paragraph(paragraph)
}.join("\n")
# Make list points stand on their own line
@@ -29,8 +29,15 @@ module ActionMailer
@_message.attachments
end
- private
- def simple_format(text, len = 72, indent = 2)
+ # Returns +text+ wrapped at +len+ columns and indented +indent+ spaces.
+ #
+ # === Examples
+ #
+ # my_text = "Here is a sample text with more than 40 characters"
+ #
+ # format_paragraph(my_text, 25, 4)
+ # # => " Here is a sample text with\n more than 40 characters"
+ def format_paragraph(text, len = 72, indent = 2)
sentences = [[]]
text.split.each do |word|
diff --git a/actionmailer/lib/rails/generators/mailer/USAGE b/actionmailer/lib/rails/generators/mailer/USAGE
index a08d459739..448ddbd5df 100644
--- a/actionmailer/lib/rails/generators/mailer/USAGE
+++ b/actionmailer/lib/rails/generators/mailer/USAGE
@@ -1,4 +1,5 @@
Description:
+============
Stubs out a new mailer and its views. Pass the mailer name, either
CamelCased or under_scored, and an optional list of emails as arguments.
@@ -6,10 +7,12 @@ Description:
engine and test framework generators.
Example:
- `rails generate mailer Notifications signup forgot_password invoice`
+========
+ rails generate mailer Notifications signup forgot_password invoice
creates a Notifications mailer class, views, test, and fixtures:
Mailer: app/mailers/notifications.rb
Views: app/views/notifications/signup.erb [...]
Test: test/functional/notifications_test.rb
Fixtures: test/fixtures/notifications/signup [...]
+
diff --git a/actionmailer/test/base_test.rb b/actionmailer/test/base_test.rb
index 1b793d255e..6a7931da8c 100644
--- a/actionmailer/test/base_test.rb
+++ b/actionmailer/test/base_test.rb
@@ -153,8 +153,8 @@ class BaseTest < ActiveSupport::TestCase
assert_equal(2, email.parts.length)
assert_equal("multipart/related", email.mime_type)
assert_equal("multipart/alternative", email.parts[0].mime_type)
- assert_equal("text/plain", email.parts[0].parts[0].mime_type)
- assert_equal("text/html", email.parts[0].parts[1].mime_type)
+ assert_equal("text/plain", email.parts[0].parts[0].mime_type)
+ assert_equal("text/html", email.parts[0].parts[1].mime_type)
assert_equal("logo.png", email.parts[1].filename)
end
diff --git a/actionmailer/test/mail_helper_test.rb b/actionmailer/test/mail_helper_test.rb
index 7cc0804323..17e9c82045 100644
--- a/actionmailer/test/mail_helper_test.rb
+++ b/actionmailer/test/mail_helper_test.rb
@@ -14,6 +14,14 @@ class HelperMailer < ActionMailer::Base
end
end
+ def use_format_paragraph
+ @text = "But soft! What light through yonder window breaks?"
+
+ mail_with_defaults do |format|
+ format.html { render(:inline => "<%= format_paragraph @text, 15, 1 %>") }
+ end
+ end
+
def use_mailer
mail_with_defaults do |format|
format.html { render(:inline => "<%= mailer.message.subject %>") }
@@ -50,5 +58,10 @@ class MailerHelperTest < ActionMailer::TestCase
mail = HelperMailer.use_message
assert_match "using helpers", mail.body.encoded
end
+
+ def test_use_format_paragraph
+ mail = HelperMailer.use_format_paragraph
+ assert_match " But soft! What\r\n light through\r\n yonder window\r\n breaks?", mail.body.encoded
+ end
end