aboutsummaryrefslogtreecommitdiffstats
path: root/actionmailer/lib/action_mailer/base.rb
diff options
context:
space:
mode:
authorAdam <kohnkecomm@Adam-iMac.local>2008-05-23 10:40:36 -0700
committerPratik Naik <pratiknaik@gmail.com>2008-05-29 10:38:00 +0100
commitcf6299dbd73a8cb6d74265df03d01abe885e686a (patch)
treee54c80862aa91a2ca8fcf48d4d0775bad0bac912 /actionmailer/lib/action_mailer/base.rb
parentabb1bd2efa43b8efbb3faf4ccfb9246704a9044c (diff)
downloadrails-cf6299dbd73a8cb6d74265df03d01abe885e686a.tar.gz
rails-cf6299dbd73a8cb6d74265df03d01abe885e686a.tar.bz2
rails-cf6299dbd73a8cb6d74265df03d01abe885e686a.zip
Add ActionMailer#reply_to. [#245 state:resolved]
Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
Diffstat (limited to 'actionmailer/lib/action_mailer/base.rb')
-rw-r--r--actionmailer/lib/action_mailer/base.rb20
1 files changed, 13 insertions, 7 deletions
diff --git a/actionmailer/lib/action_mailer/base.rb b/actionmailer/lib/action_mailer/base.rb
index 030bb178da..e065132107 100644
--- a/actionmailer/lib/action_mailer/base.rb
+++ b/actionmailer/lib/action_mailer/base.rb
@@ -35,7 +35,8 @@ 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 addresses. These addresses will receive a blind carbon copy of your email. Sets the <tt>Bcc:</tt> header.
+ # * <tt>reply_to</tt> - Takes one or more email addresses. These addresses will be listed as the default recipients when replying to your email. Sets the <tt>Reply-To:</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>.
@@ -317,6 +318,10 @@ module ActionMailer #:nodoc:
# Specify the from address for the message.
adv_attr_accessor :from
+ # Specify the address (if different than the "from" address) to direct
+ # replies to this message.
+ adv_attr_accessor :reply_to
+
# Specify additional headers to be added to the message.
adv_attr_accessor :headers
@@ -576,13 +581,14 @@ module ActionMailer #:nodoc:
def create_mail
m = TMail::Mail.new
- m.subject, = quote_any_if_necessary(charset, subject)
- m.to, m.from = quote_any_address_if_necessary(charset, recipients, from)
- m.bcc = quote_address_if_necessary(bcc, charset) unless bcc.nil?
- m.cc = quote_address_if_necessary(cc, charset) unless cc.nil?
-
+ m.subject, = quote_any_if_necessary(charset, subject)
+ m.to, m.from = quote_any_address_if_necessary(charset, recipients, from)
+ m.bcc = quote_address_if_necessary(bcc, charset) unless bcc.nil?
+ m.cc = quote_address_if_necessary(cc, charset) unless cc.nil?
+ m.reply_to = quote_address_if_necessary(reply_to, charset) unless reply_to.nil?
m.mime_version = mime_version unless mime_version.nil?
- m.date = sent_on.to_time rescue sent_on if sent_on
+ m.date = sent_on.to_time rescue sent_on if sent_on
+
headers.each { |k, v| m[k] = v }
real_content_type, ctype_attrs = parse_content_type