Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 136 lines (80 sloc) 3.801 kb
3b28380 Branching ar_mailer to version 1.3.1
zenspider authored
1 = ar_mailer
2
3 A two-phase delivery agent for ActionMailer
4
5 Rubyforge Project:
6
7 http://rubyforge.org/projects/seattlerb
8
9 Documentation:
10
11 http://seattlerb.org/ar_mailer
12
6f15646 Adam Meehan updated README install instructions and more info on init.d scripts
authored
13 and for forked additions
14
15 http://github.com/adzap/ar_mailer/wikis
16
3b28380 Branching ar_mailer to version 1.3.1
zenspider authored
17 Bugs:
18
209bd40 Adam Meehan more readme tweaks for installation
authored
19 http://adzap.lighthouseapp.com/projects/26997-ar_mailer
3b28380 Branching ar_mailer to version 1.3.1
zenspider authored
20
21 == About
22
23 Even delivering email to the local machine may take too long when you have to
24 send hundreds of messages. ar_mailer allows you to store messages into the
25 database for later delivery by a separate process, ar_sendmail.
26
6f15646 Adam Meehan updated README install instructions and more info on init.d scripts
authored
27 == Installing ar_mailer (forked)
28
209bd40 Adam Meehan more readme tweaks for installation
authored
29 Before installing you will need to make sure the original gem is uninstalled as they can't coexist:
30
31 $ sudo gem uninstall ar_mailer
32
6f15646 Adam Meehan updated README install instructions and more info on init.d scripts
authored
33 Install the gem from GitHub gems server:
34
209bd40 Adam Meehan more readme tweaks for installation
authored
35 First, if you haven't already:
6f15646 Adam Meehan updated README install instructions and more info on init.d scripts
authored
36
37 $ sudo gem sources -a http://gems.github.com
3b28380 Branching ar_mailer to version 1.3.1
zenspider authored
38
6f15646 Adam Meehan updated README install instructions and more info on init.d scripts
authored
39 Then
3b28380 Branching ar_mailer to version 1.3.1
zenspider authored
40
6f15646 Adam Meehan updated README install instructions and more info on init.d scripts
authored
41 $ sudo gem install adzap-ar_mailer
3b28380 Branching ar_mailer to version 1.3.1
zenspider authored
42
209bd40 Adam Meehan more readme tweaks for installation
authored
43 For Rails >= 2.1, in your environment.rb:
44
45 config.gem "adzap-ar_mailer", :lib => 'action_mailer/ar_mailer', :source => 'http://gems.github.com'
46
47 For Rails 2.0, in an initializer file:
48
49 require 'action_mailer/ar_mailer'
8825b7e Adam Meehan moved ar_mailer usage docs into the README and updated for changes
authored
50
51 == Usage
52
53 Go to your Rails project:
54
55 $ cd your_rails_project
56
57 Create a new migration:
58
434ace0 Adam Meehan removed TableName usage as it is redundant as the email class can be got...
authored
59 $ ar_sendmail --create-migration Emails
8825b7e Adam Meehan moved ar_mailer usage docs into the README and updated for changes
authored
60
434ace0 Adam Meehan removed TableName usage as it is redundant as the email class can be got...
authored
61 You'll need to redirect this into a file.
6fdde2f Adam Meehan little doc fix
authored
62
8825b7e Adam Meehan moved ar_mailer usage docs into the README and updated for changes
authored
63 Create a new model:
64
434ace0 Adam Meehan removed TableName usage as it is redundant as the email class can be got...
authored
65 $ ar_sendmail --create-model Email
8825b7e Adam Meehan moved ar_mailer usage docs into the README and updated for changes
authored
66
434ace0 Adam Meehan removed TableName usage as it is redundant as the email class can be got...
authored
67 You'll need to redirect this into a file.
8825b7e Adam Meehan moved ar_mailer usage docs into the README and updated for changes
authored
68
434ace0 Adam Meehan removed TableName usage as it is redundant as the email class can be got...
authored
69 In your mailer class methods you must be sure to set the From address for your emails.
70 Something like:
8825b7e Adam Meehan moved ar_mailer usage docs into the README and updated for changes
authored
71
72 def list_send(recipient)
73 from 'no_reply@example.com'
74 # ...
75
76 Edit config/environments/production.rb and set the delivery method:
77
209bd40 Adam Meehan more readme tweaks for installation
authored
78 config.action_mailer.delivery_method = :activerecord
8825b7e Adam Meehan moved ar_mailer usage docs into the README and updated for changes
authored
79
209bd40 Adam Meehan more readme tweaks for installation
authored
80 Or if you need to, you can set each mailer class delivery method individually:
8825b7e Adam Meehan moved ar_mailer usage docs into the README and updated for changes
authored
81
82 class MyMailer < ActionMailer::Base
83 self.delivery_method = :activerecord
84 end
85
86 This can be useful when using plugins like ExceptionNotification. Where it
87 might be foolish to tie the sending of the email alert to the database when the
88 database might be causing the exception being raised. In this instance you could
209bd40 Adam Meehan more readme tweaks for installation
authored
89 override ExceptionNofitier delivery method to be smtp or set the other
90 mailer classes to use ARMailer explicitly.
8825b7e Adam Meehan moved ar_mailer usage docs into the README and updated for changes
authored
91
209bd40 Adam Meehan more readme tweaks for installation
authored
92 Then to run it:
8825b7e Adam Meehan moved ar_mailer usage docs into the README and updated for changes
authored
93
94 $ ar_sendmail
95
96 You can also run it from cron with -o, or as a daemon with -d.
97
98 See <tt>ar_sendmail -h</tt> for full details.
99
100 === Alternate Mail Storage
101
434ace0 Adam Meehan removed TableName usage as it is redundant as the email class can be got...
authored
102 By default ar_mailer assumes you are using an ActiveRecord model called
103 Email to store the emails created before sending. If you want to change
104 this you alter it in an intializer like so:
105
106 ActionMailer::Base.email_class = Newsletter
8825b7e Adam Meehan moved ar_mailer usage docs into the README and updated for changes
authored
107
fa9b3f3 Adam Meehan minor doc tweak
authored
108 === A Word on TLS
b3bcd60 Adam Meehan allow smtp setting of :tls => false to explicity disable TLS auto start ...
authored
109
fa9b3f3 Adam Meehan minor doc tweak
authored
110 If you are using Ruby >= 1.8.7, TLS will be enabled automatically if your
b3bcd60 Adam Meehan allow smtp setting of :tls => false to explicity disable TLS auto start ...
authored
111 SMTP server supports it. If you do not want it to automatically enabled then
112 set the :tls option to false in your smtp_settings.
113
fa9b3f3 Adam Meehan minor doc tweak
authored
114 If you are on Ruby <= 1.8.6, then the TLS patch included in this plugin will
b3bcd60 Adam Meehan allow smtp setting of :tls => false to explicity disable TLS auto start ...
authored
115 be loaded, so you don't need another TLS plugin to add the capability. This
116 patch allows you to explicit set if the server supports TLS by setting the
117 :tls option to true in your smtp_settings.
8825b7e Adam Meehan moved ar_mailer usage docs into the README and updated for changes
authored
118
119 === Help
3b28380 Branching ar_mailer to version 1.3.1
zenspider authored
120
121 See ar_sendmail -h for options to ar_sendmail.
122
123 NOTE: You may need to delete an smtp_tls.rb file if you have one lying
124 around. ar_mailer supplies it own.
125
8825b7e Adam Meehan moved ar_mailer usage docs into the README and updated for changes
authored
126 == Run as a service (init.d/rc.d scripts)
3b28380 Branching ar_mailer to version 1.3.1
zenspider authored
127
6f15646 Adam Meehan updated README install instructions and more info on init.d scripts
authored
128 For Linux both script and demo config files are in share/linux.
129 See ar_sendmail.conf for setting up your config. Copy the ar_sendmail file
130 to /etc/init.d/ and make it executable. Then for Debian based distros run
131 'sudo update-rc.d ar_sendmail defaults' and it should work. Make sure you have
132 the config file /etc/ar_sendmail.conf in place before starting.
3b28380 Branching ar_mailer to version 1.3.1
zenspider authored
133
6f15646 Adam Meehan updated README install instructions and more info on init.d scripts
authored
134 For FreeBSD or NetBSD script is share/bsd/ar_sendmail. This is old and does not
135 support the config file unless someone wants to submit a patch.
Something went wrong with that request. Please try again.