aboutsummaryrefslogtreecommitdiffstats
path: root/guides/source/action_mailer_basics.textile
diff options
context:
space:
mode:
authorAditya Sanghi <aditya.sanghi@risingsuntech.net>2012-09-07 02:02:33 +0530
committerAditya Sanghi <aditya.sanghi@risingsuntech.net>2012-09-07 02:02:33 +0530
commitfd6b9f3ce17a0223ce09d0e0b8da3ed8e9c8b235 (patch)
tree4a13ebe945ae964cc0a1189729fd50d45a423381 /guides/source/action_mailer_basics.textile
parentd016decb47b3bc1a9ab7f4e2f82cf54de1f23965 (diff)
downloadrails-fd6b9f3ce17a0223ce09d0e0b8da3ed8e9c8b235.tar.gz
rails-fd6b9f3ce17a0223ce09d0e0b8da3ed8e9c8b235.tar.bz2
rails-fd6b9f3ce17a0223ce09d0e0b8da3ed8e9c8b235.zip
Added information about dynamic delivery options to action mailer guides
Diffstat (limited to 'guides/source/action_mailer_basics.textile')
-rw-r--r--guides/source/action_mailer_basics.textile18
1 files changed, 18 insertions, 0 deletions
diff --git a/guides/source/action_mailer_basics.textile b/guides/source/action_mailer_basics.textile
index bca403ae72..9c4ce47945 100644
--- a/guides/source/action_mailer_basics.textile
+++ b/guides/source/action_mailer_basics.textile
@@ -410,6 +410,24 @@ end
The above will send a multipart email with an attachment, properly nested with the top level being <tt>multipart/mixed</tt> and the first part being a <tt>multipart/alternative</tt> containing the plain text and HTML email messages.
+h5. Sending Emails with Dynamic Delivery Options
+
+At times you may wish to override the default delivery options (e.g. smtp credentials) while delivering emails. This can be achieved using +delivey_method_options+ in the mailer action.
+
+<ruby>
+class UserMailer < ActionMailer::Base
+ def welcome_email(user,company)
+ @user = user
+ @url = user_url(@user)
+ mail(:to => user.email,
+ :subject => "Please see the Terms and Conditions attached",
+ :delivery_method_options => {:user_name => company.smtp_user,
+ :password => company.smtp_password,
+ :address => company.smtp_host})
+ end
+end
+</ruby>
+
h3. Receiving Emails
Receiving and parsing emails with Action Mailer can be a rather complex endeavor. Before your email reaches your Rails app, you would have had to configure your system to somehow forward emails to your app, which needs to be listening for that. So, to receive emails in your Rails app you'll need to: