aboutsummaryrefslogtreecommitdiffstats
path: root/actionmailer
diff options
context:
space:
mode:
authorTomK32 <tomk32@tomk32.de>2008-05-16 11:13:32 +0200
committerTomK32 <tomk32@tomk32.de>2008-05-16 11:13:32 +0200
commitfa0cca368f74119b561595cc6ca7454f7debdf6b (patch)
tree85022a5047c4d8da55a981cc3c1b8cc65f1adcd8 /actionmailer
parentf16c22040d5b66cb285fbd9a90858294376192bb (diff)
parent4e2bc02163aa646ab1304b1b5bec98a7af8927f5 (diff)
downloadrails-fa0cca368f74119b561595cc6ca7454f7debdf6b.tar.gz
rails-fa0cca368f74119b561595cc6ca7454f7debdf6b.tar.bz2
rails-fa0cca368f74119b561595cc6ca7454f7debdf6b.zip
Merge branch 'master' of git@github.com:lifo/docrails
Diffstat (limited to 'actionmailer')
-rw-r--r--actionmailer/CHANGELOG2
-rw-r--r--actionmailer/MIT-LICENSE2
-rwxr-xr-xactionmailer/README17
-rwxr-xr-xactionmailer/Rakefile2
-rwxr-xr-xactionmailer/lib/action_mailer.rb2
-rw-r--r--actionmailer/lib/action_mailer/base.rb138
-rw-r--r--actionmailer/lib/action_mailer/version.rb2
7 files changed, 85 insertions, 80 deletions
diff --git a/actionmailer/CHANGELOG b/actionmailer/CHANGELOG
index 15c9964d9b..b2ce462f0c 100644
--- a/actionmailer/CHANGELOG
+++ b/actionmailer/CHANGELOG
@@ -1,4 +1,4 @@
-*SVN*
+*2.1.0 RC1 (May 11th, 2008)*
* Fixed that a return-path header would be ignored #7572 [joost]
diff --git a/actionmailer/MIT-LICENSE b/actionmailer/MIT-LICENSE
index 007cc942e1..13c90d46e9 100644
--- a/actionmailer/MIT-LICENSE
+++ b/actionmailer/MIT-LICENSE
@@ -1,4 +1,4 @@
-Copyright (c) 2004-2007 David Heinemeier Hansson
+Copyright (c) 2004-2008 David Heinemeier Hansson
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
diff --git a/actionmailer/README b/actionmailer/README
index d9012704ad..0e16ea6ec6 100755
--- a/actionmailer/README
+++ b/actionmailer/README
@@ -19,8 +19,7 @@ are all set up this way. An example of such a method:
recipients recipient
subject "[Signed up] Welcome #{recipient}"
from "system@loudthinking.com"
-
- body(:recipient => recipient)
+ body :recipient => recipient
end
The body of the email is created by using an Action View template (regular
@@ -91,13 +90,13 @@ a limited number of email.
The Base class has the full list of configuration options. Here's an example:
-ActionMailer::Base.smtp_settings = {
- :address=>'smtp.yourserver.com', # default: localhost
- :port=>'25', # default: 25
- :user_name=>'user',
- :password=>'pass',
- :authentication=>:plain # :plain, :login or :cram_md5
-}
+ ActionMailer::Base.smtp_settings = {
+ :address => 'smtp.yourserver.com', # default: localhost
+ :port => '25', # default: 25
+ :user_name => 'user',
+ :password => 'pass',
+ :authentication => :plain # :plain, :login or :cram_md5
+ }
== Dependencies
diff --git a/actionmailer/Rakefile b/actionmailer/Rakefile
index 75c3eb2db9..22ed396417 100755
--- a/actionmailer/Rakefile
+++ b/actionmailer/Rakefile
@@ -55,7 +55,7 @@ spec = Gem::Specification.new do |s|
s.rubyforge_project = "actionmailer"
s.homepage = "http://www.rubyonrails.org"
- s.add_dependency('actionpack', '= 2.0.2' + PKG_BUILD)
+ s.add_dependency('actionpack', '= 2.0.991' + PKG_BUILD)
s.has_rdoc = true
s.requirements << 'none'
diff --git a/actionmailer/lib/action_mailer.rb b/actionmailer/lib/action_mailer.rb
index ec803f5a8e..2e324d4637 100755
--- a/actionmailer/lib/action_mailer.rb
+++ b/actionmailer/lib/action_mailer.rb
@@ -1,5 +1,5 @@
#--
-# Copyright (c) 2004-2007 David Heinemeier Hansson
+# Copyright (c) 2004-2008 David Heinemeier Hansson
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
diff --git a/actionmailer/lib/action_mailer/base.rb b/actionmailer/lib/action_mailer/base.rb
index a3762bf81b..7ed133d099 100644
--- a/actionmailer/lib/action_mailer/base.rb
+++ b/actionmailer/lib/action_mailer/base.rb
@@ -11,11 +11,11 @@ module ActionMailer #:nodoc:
# = Mailer Models
#
# To use ActionMailer, you need to create a mailer model.
- #
+ #
# $ script/generate mailer Notifier
#
- # The generated model inherits from ActionMailer::Base. Emails are defined by creating methods within the model which are then
- # used to set variables to be used in the mail template, to change options on the mail, or
+ # The generated model inherits from ActionMailer::Base. Emails are defined by creating methods within the model which are then
+ # used to set variables to be used in the mail template, to change options on the mail, or
# to add attachments.
#
# Examples:
@@ -35,7 +35,7 @@ module ActionMailer #:nodoc:
# * <tt>subject</tt> - The subject of your email. Sets the <tt>Subject:</tt> header.
# * <tt>from</tt> - Who the email you are sending is from. Sets the <tt>From:</tt> header.
# * <tt>cc</tt> - Takes one or more email addresses. These addresses will receive a carbon copy of your email. Sets the <tt>Cc:</tt> header.
- # * <tt>bcc</tt> - Takes one or more email address. These addresses will receive a blind carbon copy of your email. Sets the <tt>Bcc</tt> header.
+ # * <tt>bcc</tt> - Takes one or more email address. These addresses will receive a blind carbon copy of your email. Sets the <tt>Bcc:</tt> header.
# * <tt>sent_on</tt> - The date on which the message was sent. If not set, the header wil be set by the delivery agent.
# * <tt>content_type</tt> - Specify the content type of the message. Defaults to <tt>text/plain</tt>.
# * <tt>headers</tt> - Specify additional headers to be set for the message, e.g. <tt>headers 'X-Mail-Count' => 107370</tt>.
@@ -48,7 +48,7 @@ module ActionMailer #:nodoc:
# named after each key in the hash containing the value that that key points to.
#
# So, for example, <tt>body :account => recipient</tt> would result
- # in an instance variable <tt>@account</tt> with the value of <tt>recipient</tt> being accessible in the
+ # in an instance variable <tt>@account</tt> with the value of <tt>recipient</tt> being accessible in the
# view.
#
#
@@ -57,7 +57,7 @@ module ActionMailer #:nodoc:
# Like ActionController, each mailer class has a corresponding view directory
# in which each method of the class looks for a template with its name.
# To define a template to be used with a mailing, create an <tt>.erb</tt> file with the same name as the method
- # in your mailer model. For example, in the mailer defined above, the template at
+ # in your mailer model. For example, in the mailer defined above, the template at
# <tt>app/views/notifier/signup_notification.erb</tt> would be used to generate the email.
#
# Variables defined in the model are accessible as instance variables in the view.
@@ -71,48 +71,48 @@ module ActionMailer #:nodoc:
#
# You got a new note!
# <%= truncate(note.body, 25) %>
- #
+ #
#
# = Generating URLs
- #
+ #
# URLs can be generated in mailer views using <tt>url_for</tt> or named routes.
- # Unlike controllers from Action Pack, the mailer instance doesn't have any context about the incoming request,
- # so you'll need to provide all of the details needed to generate a URL.
+ # Unlike controllers from Action Pack, the mailer instance doesn't have any context about the incoming request,
+ # so you'll need to provide all of the details needed to generate a URL.
#
# When using <tt>url_for</tt> you'll need to provide the <tt>:host</tt>, <tt>:controller</tt>, and <tt>:action</tt>:
- #
+ #
# <%= url_for(:host => "example.com", :controller => "welcome", :action => "greeting") %>
#
# When using named routes you only need to supply the <tt>:host</tt>:
- #
+ #
# <%= users_url(:host => "example.com") %>
#
# You will want to avoid using the <tt>name_of_route_path</tt> form of named routes because it doesn't make sense to
# generate relative URLs in email messages.
#
- # It is also possible to set a default host that will be used in all mailers by setting the <tt>:host</tt> option in
+ # It is also possible to set a default host that will be used in all mailers by setting the <tt>:host</tt> option in
# the <tt>ActionMailer::Base.default_url_options</tt> hash as follows:
#
# ActionMailer::Base.default_url_options[:host] = "example.com"
- #
+ #
# This can also be set as a configuration option in <tt>config/environment.rb</tt>:
#
# config.action_mailer.default_url_options = { :host => "example.com" }
#
# If you do decide to set a default <tt>:host</tt> for your mailers you will want to use the
# <tt>:only_path => false</tt> option when using <tt>url_for</tt>. This will ensure that absolute URLs are generated because
- # the <tt>url_for</tt> view helper will, by default, generate relative URLs when a <tt>:host</tt> option isn't
+ # the <tt>url_for</tt> view helper will, by default, generate relative URLs when a <tt>:host</tt> option isn't
# explicitly provided.
#
# = Sending mail
#
- # Once a mailer action and template are defined, you can deliver your message or create it and save it
+ # Once a mailer action and template are defined, you can deliver your message or create it and save it
# for delivery later:
#
# Notifier.deliver_signup_notification(david) # sends the email
# mail = Notifier.create_signup_notification(david) # => a tmail object
# Notifier.deliver(mail)
- #
+ #
# You never instantiate your mailer class. Rather, your delivery instance
# methods are automatically wrapped in class methods that start with the word
# <tt>deliver_</tt> followed by the name of the mailer method that you would
@@ -127,13 +127,13 @@ module ActionMailer #:nodoc:
#
# class MyMailer < ActionMailer::Base
# def signup_notification(recipient)
- # recipients recipient.email_address_with_name
- # subject "New account information"
- # body "account" => recipient
- # from "system@example.com"
- # content_type "text/html" # Here's where the magic happens
+ # recipients recipient.email_address_with_name
+ # subject "New account information"
+ # from "system@example.com"
+ # body :account => recipient
+ # content_type "text/html"
# end
- # end
+ # end
#
#
# = Multipart email
@@ -145,6 +145,7 @@ module ActionMailer #:nodoc:
# recipients recipient.email_address_with_name
# subject "New account information"
# from "system@example.com"
+ # content_type "multipart/alternative"
#
# part :content_type => "text/html",
# :body => render_message("signup-as-html", :account => recipient)
@@ -155,21 +156,26 @@ module ActionMailer #:nodoc:
# end
# end
# end
- #
+ #
# Multipart messages can also be used implicitly because ActionMailer will automatically
# detect and use multipart templates, where each template is named after the name of the action, followed
# by the content type. Each such detected template will be added as separate part to the message.
- #
+ #
# For example, if the following templates existed:
# * signup_notification.text.plain.erb
# * signup_notification.text.html.erb
# * signup_notification.text.xml.builder
# * signup_notification.text.x-yaml.erb
- #
+ #
# Each would be rendered and added as a separate part to the message,
- # with the corresponding content type. The same body hash is passed to
- # each template.
+ # with the corresponding content type. The content type for the entire
+ # message is automatically set to <tt>multipart/alternative</tt>, which indicates
+ # that the email contains multiple different representations of the same email
+ # body. The same body hash is passed to each template.
#
+ # Implicit template rendering is not performed if any attachments or parts have been added to the email.
+ # This means that you'll have to manually add each part to the email and set the content type of the email
+ # to <tt>multipart/alternative</tt>.
#
# = Attachments
#
@@ -191,7 +197,7 @@ module ActionMailer #:nodoc:
# a.body = generate_your_pdf_here()
# end
# end
- # end
+ # end
#
#
# = Configuration options
@@ -210,11 +216,11 @@ module ActionMailer #:nodoc:
# * <tt>:user_name</tt> - If your mail server requires authentication, set the username in this setting.
# * <tt>:password</tt> - If your mail server requires authentication, set the password in this setting.
# * <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>, <tt>:login</tt>, <tt>:cram_md5</tt>
+ # This is a symbol and one of <tt>:plain</tt>, <tt>:login</tt>, <tt>:cram_md5</tt>.
#
- # * <tt>sendmail_settings</tt> - Allows you to override options for the <tt>:sendmail</tt> delivery method
- # * <tt>:location</tt> - The location of the sendmail executable, defaults to "/usr/sbin/sendmail"
- # * <tt>:arguments</tt> - The command line arguments
+ # * <tt>sendmail_settings</tt> - Allows you to override options for the <tt>:sendmail</tt> delivery method.
+ # * <tt>:location</tt> - The location of the sendmail executable. Defaults to <tt>/usr/sbin/sendmail</tt>.
+ # * <tt>:arguments</tt> - The command line arguments. Defaults to <tt>-i -t</tt>.
#
# * <tt>raise_delivery_errors</tt> - Whether or not errors should be raised if the email fails to be delivered.
#
@@ -227,16 +233,16 @@ module ActionMailer #:nodoc:
# for unit and functional testing.
#
# * <tt>default_charset</tt> - The default charset used for the body and to encode the subject. Defaults to UTF-8. You can also
- # pick a different charset from inside a method with <tt>@charset</tt>.
+ # pick a different charset from inside a method with +charset+.
# * <tt>default_content_type</tt> - The default content type used for the main part of the message. Defaults to "text/plain". You
- # can also pick a different content type from inside a method with <tt>@content_type</tt>.
- # * <tt>default_mime_version</tt> - The default mime version used for the message. Defaults to "1.0". You
- # can also pick a different value from inside a method with <tt>@mime_version</tt>.
+ # can also pick a different content type from inside a method with +content_type+.
+ # * <tt>default_mime_version</tt> - The default mime version used for the message. Defaults to <tt>1.0</tt>. You
+ # can also pick a different value from inside a method with +mime_version+.
# * <tt>default_implicit_parts_order</tt> - When a message is built implicitly (i.e. multiple parts are assembled from templates
# which specify the content type in their filenames) this variable controls how the parts are ordered. Defaults to
- # ["text/html", "text/enriched", "text/plain"]. Items that appear first in the array have higher priority in the mail client
+ # <tt>["text/html", "text/enriched", "text/plain"]</tt>. Items that appear first in the array have higher priority in the mail client
# and appear last in the mime encoded message. You can also pick a different order from inside a method with
- # <tt>@implicit_parts_order</tt>.
+ # +implicit_parts_order+.
class Base
include AdvAttrAccessor, PartContainer
include ActionController::UrlWriter if Object.const_defined?(:ActionController)
@@ -249,16 +255,16 @@ module ActionMailer #:nodoc:
cattr_accessor :template_extensions
@@template_extensions = ['erb', 'builder', 'rhtml', 'rxml']
- @@smtp_settings = {
- :address => "localhost",
- :port => 25,
- :domain => 'localhost.localdomain',
- :user_name => nil,
- :password => nil,
+ @@smtp_settings = {
+ :address => "localhost",
+ :port => 25,
+ :domain => 'localhost.localdomain',
+ :user_name => nil,
+ :password => nil,
:authentication => nil
}
cattr_accessor :smtp_settings
-
+
@@sendmail_settings = {
:location => '/usr/sbin/sendmail',
:arguments => '-i -t'
@@ -270,10 +276,10 @@ module ActionMailer #:nodoc:
superclass_delegating_accessor :delivery_method
self.delivery_method = :smtp
-
+
@@perform_deliveries = true
cattr_accessor :perform_deliveries
-
+
@@deliveries = []
cattr_accessor :deliveries
@@ -282,7 +288,7 @@ module ActionMailer #:nodoc:
@@default_content_type = "text/plain"
cattr_accessor :default_content_type
-
+
@@default_mime_version = "1.0"
cattr_accessor :default_mime_version
@@ -291,47 +297,47 @@ module ActionMailer #:nodoc:
# Specify the BCC addresses for the message
adv_attr_accessor :bcc
-
+
# Define the body of the message. This is either a Hash (in which case it
# specifies the variables to pass to the template when it is rendered),
# or a string, in which case it specifies the actual text of the message.
adv_attr_accessor :body
-
+
# Specify the CC addresses for the message.
adv_attr_accessor :cc
-
+
# Specify the charset to use for the message. This defaults to the
# +default_charset+ specified for ActionMailer::Base.
adv_attr_accessor :charset
-
+
# Specify the content type for the message. This defaults to <tt>text/plain</tt>
# in most cases, but can be automatically set in some situations.
adv_attr_accessor :content_type
-
+
# Specify the from address for the message.
adv_attr_accessor :from
-
+
# Specify additional headers to be added to the message.
adv_attr_accessor :headers
-
+
# Specify the order in which parts should be sorted, based on content-type.
# This defaults to the value for the +default_implicit_parts_order+.
adv_attr_accessor :implicit_parts_order
-
+
# Defaults to "1.0", but may be explicitly given if needed.
adv_attr_accessor :mime_version
-
+
# The recipient addresses for the message, either as a string (for a single
# address) or an array (for multiple addresses).
adv_attr_accessor :recipients
-
+
# The date on which the message was sent. If not set (the default), the
# header will be set by the delivery agent.
adv_attr_accessor :sent_on
-
+
# Specify the subject of the message.
adv_attr_accessor :subject
-
+
# Specify the template name to use for current message. This is the "base"
# template name, without the extension or directory, and may be used to
# have multiple mailer methods share the same template.
@@ -347,7 +353,7 @@ module ActionMailer #:nodoc:
self.class.mailer_name
end
end
-
+
def mailer_name=(value)
self.class.mailer_name = value
end
@@ -425,7 +431,7 @@ module ActionMailer #:nodoc:
# remain uninitialized (useful when you only need to invoke the "receive"
# method, for instance).
def initialize(method_name=nil, *parameters) #:nodoc:
- create!(method_name, *parameters) if method_name
+ create!(method_name, *parameters) if method_name
end
# Initialize the mailer via the given +method_name+. The body will be
@@ -511,7 +517,7 @@ module ActionMailer #:nodoc:
@content_type ||= @@default_content_type.dup
@implicit_parts_order ||= @@default_implicit_parts_order.dup
@template ||= method_name
- @mailer_name ||= Inflector.underscore(self.class.name)
+ @mailer_name ||= self.class.name.underscore
@parts ||= []
@headers ||= {}
@body ||= {}
@@ -597,7 +603,7 @@ module ActionMailer #:nodoc:
part = (TMail::Mail === p ? p : p.to_mail(self))
m.parts << part
end
-
+
if real_content_type =~ /multipart/
ctype_attrs.delete "charset"
m.set_content_type(real_content_type, nil, ctype_attrs)
@@ -612,7 +618,7 @@ module ActionMailer #:nodoc:
mail.ready_to_send
sender = mail['return-path'] || mail.from
- Net::SMTP.start(smtp_settings[:address], smtp_settings[:port], smtp_settings[:domain],
+ Net::SMTP.start(smtp_settings[:address], smtp_settings[:port], smtp_settings[:domain],
smtp_settings[:user_name], smtp_settings[:password], smtp_settings[:authentication]) do |smtp|
smtp.sendmail(mail.encoded, sender, destinations)
end
diff --git a/actionmailer/lib/action_mailer/version.rb b/actionmailer/lib/action_mailer/version.rb
index 954a472757..88b9a3c200 100644
--- a/actionmailer/lib/action_mailer/version.rb
+++ b/actionmailer/lib/action_mailer/version.rb
@@ -2,7 +2,7 @@ module ActionMailer
module VERSION #:nodoc:
MAJOR = 2
MINOR = 0
- TINY = 2
+ TINY = 991
STRING = [MAJOR, MINOR, TINY].join('.')
end