/[drupal]/contributions/modules/og2list/postfix.INSTALL
ViewVC logotype

Contents of /contributions/modules/og2list/postfix.INSTALL

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.11 - (show annotations) (download) (as text)
Wed Oct 4 08:01:43 2006 UTC (3 years, 1 month ago) by killes
Branch: MAIN
CVS Tags: HEAD
Changes since 1.10: +1 -1 lines
File MIME type: text/x-php
typo
1
2 Pre-Requisites for Installing OG2list with Postfix
3
4 1. Perl and Perl Modules
5 - FindBin
6 - Mail::Verp
7 - MIME::Parser
8 - MIME::Words
9 - DBI
10 - Getopt::Std
11 - Encode
12
13 2. Postfix or Exim as your MTA.
14
15 3. Configuration of your MTA so that the OG2list router and transport only handle the mail they are supposed to. Otherwise, the OG2list router and transport will take in and send out all mail sent to the server. Which will effectively render email that wasnt meant for OG2list useless.
16
17 4. A dedicated domain or sub-domain (localhost will do)
18
19 5. CVS and SVN are recommended
20
21 6. Shell Access to your server with sudo/root privileges
22
23 7. Drupal 4.7
24
25 8. If your on OS X. You will need to install Wget for the drupal cronjobs. You will also need to install lynx for CPAN. You can use Fink (http://fink.sourceforge.net/) to do this
26
27 This was written as a guide to installing the OG2list module on OS X using the postfix MTA.
28 The instructions should be relevant for any *nix based OS though.
29
30 Step 1 : Install Perl Pre requisites
31
32 A. Install CPAN
33
34 To get CPAN do this:
35 OS X : Install Xcode
36
37 After you have the Xcode package you will have access to perl and its package management system, CPAN.
38 CPAN allows you to install extra packages and modules for Perl to use. OG2list relies on 3 more than come default.
39
40 To access CPAN, as root, type:
41
42 'cpan'
43
44 you should see
45
46 cpan shell -- CPAN exploration and modules installation (v1.7601)
47 ReadLine support available (try 'install Bundle::CPAN')
48
49 cpan>
50
51 you can perform the installs by typing each of the install lines below, each install will have its own set of prompts and questions - agree to everything:
52
53 B. Install Perl Modules
54 From within CPAN, do...
55
56 install DBD::mysql
57
58 then
59
60 install Mail::Verp
61
62 then
63
64 install DBI
65
66 then
67
68 install FindBin
69
70 then
71
72 install Getopt::Std
73
74 then
75
76 install MIME::Parser
77
78 then
79
80 install MIME::Words
81
82 then
83
84 install Encode
85
86
87
88 Step 2: Postfix Main.cf Configuration
89
90 There are two lines which you must put into your postfix configuration file. They are relay_domain and transport_maps. The syntax shows you what to put in your configuration file and the example shows what I placed in my configuration file.
91 Place them into your postfix config file at the bottom exactly like the EXAMPLES. Please make sure that they have not already been declared elsewhere in the file.
92
93 The '/etc/postfix/main.cf' is Postfix' main configuration file (http://www.postfix.org/postconf.5.html). Place these entries into it, make sure to double check that they dont already exist:
94
95 A. Add the relay_domains option to your main.cf file
96
97 Relay Domain List
98 Your Relay Domain List is simply the list of domains you will be hosting the mail for, if you are setting this up locally for testing. You can use localhost.
99 http://www.postfix.org/postconf.5.html#relay_domains
100
101 Syntax
102 relay_domains = your.domain.com
103
104 Place this in your file:
105
106 relay_domains = localhost
107
108 B. Add the transport_maps option to your main.cf file
109
110 Transport Maps
111 http://www.postfix.org/postconf.5.html#transport_maps
112
113 Syntax
114 transport_maps = type:/path/to/transport
115
116 Place this in your file:
117
118 transport_maps = hash:/etc/postfix/transport
119
120
121 Step 3: Drupal/Civicspace Installation
122
123 A. Install Civicspace
124
125 cd /Library/WebServer/Documents/
126 svn co svn://svn.civicspacelabs.com/trunk civicspace
127 chmod -R o+w civicspace/sites civicspace/files
128
129 or Drupal
130
131 cvs -z6 -d:pserver:anonymous:anonymous@cvs.drupal.org:/cvs/drupal co -r DRUPAL-4-7 drupal
132 chmod -R o+w drupal/sites drupal/files
133
134 B. checkout the latest og2list,og, and og_forum modules from CVS
135
136 cvs -z6 -d:pserver:anonymous:anonymous@cvs.drupal.org:/cvs/drupal-contrib checkout contributions/modules/og
137 cvs -z6 -d:pserver:anonymous:anonymous@cvs.drupal.org:/cvs/drupal-contrib checkout contributions/modules/og_forum
138 cvs -z6 -d:pserver:anonymous:anonymous@cvs.drupal.org:/cvs/drupal-contrib checkout contributions/modules/og2list
139 cvs -z6 -d:pserver:anonymous:anonymous@cvs.drupal.org:/cvs/drupal-contrib checkout contributions/modules/views
140
141 C. Move the modules into your Civicspace modules directory
142
143 mv contributions/modules/* /path/to/civicspace/modules/
144
145
146 Step 4: Install OG
147
148 The full and latest OG documentation for drupal 4.7 can be found here.
149 http://cvs.drupal.org/viewcvs/drupal/contributions/modules/og/readme.txt?rev=1.32&view=markup
150
151
152 Step 5: Install og_forum
153
154 A. Enable it from admin >> modules
155
156
157 Step 6: Install the OG2list module.
158
159 A. Enable the module in the Drupal module selection screen. (admin >> modules)
160
161 You will also need the following modules enabled:
162 - og.module (should be already enabled.)
163 - og_forum.module (should be already enabled.)
164 - forum.module
165 - taxonomy.module
166 - views.module
167
168 C. Make sure your domain is listed under "Mail Domain:" on
169
170 administer >> settings >> og2list
171
172 D. Make sure a vocabulary for the forum does exist.
173 You can check for it on
174
175 administer >> forums.
176
177
178 Step 7: Assign appropriate permissions for the newly installed modules on
179
180 administer >> access control.
181
182
183 Step 8: OS Configuration
184
185 A.Create a new user "og2list". Put the Perl files and the
186 mail.conf from the package into this user's home directory.
187
188 cp /Library/Webserver/Documents/civicspace/modules/og2list/*.pl /Users/og2list/
189 cp /Library/Webserver/Documents/civicspace/modules/og2list/mail.conf /Users/og2list/
190
191 B.Set up a cron job that accesses the file mail-out.pl in regular intervals. Locate your wget by issuing this command:
192
193 which wget
194
195 sudo crontab -u og2list -e
196
197 Place the following lines in your crontab, assuming which wget returned /sw/bin/wget:
198
199 */2 * * * * /Users/og2list/mail-out.pl
200 */5 * * * * /sw/bin/wget -O - -q http://localhost/civicspace/cron.php
201
202 The user that executes the script needs permissions to read the
203 configuration file and to set an arbitrary envelope-sender when
204 sending mails. It is best to let the
205 cronjob belong to the user you created in step A.
206
207 C. Edit the file mail.conf for you mail domain and your database.
208
209 First configure you mail domain that you set in /etc/postfix/main.cf
210 $mail_domain = "localhost"; <== this should be the domain you use for sending mail.
211
212 Then configure your database as you did in sites/default/settings.php
213 $dbase = ""; <== name of your Drupal database
214 $dbhost = "localhost"; <== name of your database server
215 $dbuser = ""; <== name of your database user
216 $dbauth = ""; <== the user's password for your database server
217
218
219 D. Make sure your Drupal cron job runs often enough. The cronjob will
220 take the mail that postfix put into the og2list database tables and make
221 Drupal nodes and comments from it.
222
223 E.Make sure that no unauthorized people can access cron.php and start
224 cronjobs that might confuse our own running cronjobs. You can do so
225 by only allowing your own server to access cron.php in the .htaccess file:
226
227 Add this to the .htaccess in the top level of your civicspace directory.
228
229 Order deny,allow
230 Deny from all
231 Allow from 123.456.78.90
232
233 Fill in your IP address in the Allow From line
234
235 Step 9 : Postfix Transport Configuration
236
237 The '/etc/postfix/transport' file lists the mapping for domains to transports for Postfix (http://www.postfix.org/transport.5.html).
238 We want to point your domain at "drupal:"
239
240 Drupal Transport
241
242 Syntax
243 transport:nexthop
244
245 A. Place this into /etc/postfix/transport
246
247 localhost drupal:
248
249 B. It's strongly recommended that you also add these two lines:
250
251 abuse@localhost local:
252 postmaster@localhost local:
253
254 So your /etc/postfix/transport should have 3 lines at the bottom that look like this:
255
256 localhost drupal:
257 abuse@localhost local:
258 postmaster@localhost local:
259
260 C. After changing the '/etc/postfix/transport' file run
261
262 'postmap /etc/postfix/transport'
263
264 and the file '/etc/postfix/transport.db' will be hashed. You will need to rehash your transport file if for some reason you make any other changes to it.
265
266 These forward all mails to the given email addresses to the aliases
267 'abuse' and 'postmaster' that you probably already have set up in your
268 '/etc/aliases' file. Every domain needs to have a person reading those
269 two accounts to deal with technical mail problems or spamming attacks. Explain in more detail how to check this...
270
271 D. Try
272
273 'postconf transport_maps'
274
275 and see if the result looks like 'hash:/etc/postfix/transport'. If it does you've set up your transport maps. If it doesnt please recheck transport_maps in /etc/postfix/main.cf
276
277 E. Now that you told Postfix to send all mails for your special domain to
278 the 'drupal:' transport you finally need to define this transport.
279 Add the following lines to your '/etc/postfix/master.cf' file, you can just throw it in at the bottom, please pay careful attention to the "user" and "argv" parameters:
280 Make sure that the first line has 0 whitespace in front of it and the second two lines have 2 whitespaces before them.
281
282 drupal unix - n n - - pipe
283 flags=DRhu user=og2list argv=/Users/og2list/mail-in.pl \
284 -f ${sender} -t ${recipient}
285
286 (Note: the first line needs to start at column 0 in your configuration file.
287 Indent the next line by whitespace.)
288
289 F. Finally restart the Postfix service ('postfix reload') and try a
290 'postfix check' to see whether you made any major mistakes. No output
291 means that everything is well.
292
293 Switch to super user sudo su root
294
295 postfix reload
296 postfix check
297
298 Step 6: Test It
299
300 A. Create at least 2 users on your site.
301
302 B. Create a group on your site.
303
304 C. For each of the users you created in step 1, do:
305 a. subscribe them to the group you created in step2.
306 b. Under the group details block. click 'my subscription' and enable Email Notification.
307
308 D. Make a new forum post.
309
310 E. Add some comments to that post
311
312 Debugging - or what to do if something does not work
313 ----------------------------------------------------
314
315
316 A) No mail is recieved by the group
317
318 If you have sent mail to your groups address and it is not appearing inside your groups forum. Try these debugging steps.
319
320 0) Make sure postfix is running and is the MTA for the domain you are trying to send to.
321
322 TODO: ps -aux|grep postfix
323
324 TODO: Add link to run this script http://cvs.drupal.org/viewcvs/drupal/contributions/modules/devel/generate/generate-og-users.php
325
326 1) Enable your mysql query log and check to make sure the messages are getting inserted into the og2list tables.
327
328
329 The mysql configuration files, called my.cnf, are located in different places depending on your setup. Most popular place is /etc/my.cnf
330 If you absolutely cant find your my.cnf file. Find all instances by doing
331
332 sudo find / -iname 'my.cnf'
333
334 mysql 4.1 - add
335 log=/path/to/logfile
336 under [mysqld] in your my.cnf and then restart mysql
337
338 mysql 5.1 - add
339 log=/path/to/logfile
340 under [mysqld] in your my.cnf and then restart mysql with
341 sudo /path/to/mysql/bin/mysqld_safe --user=mysql --log --log-output=FILE &
342
343 In order to recreate the situation
344 a) send mail to a group address
345
346 echo "some sort of text" >> ~/test-mail.txt
347
348 There are testmails located under /path/to/civicspace/modules/og2list/testmails
349 Youll need to edit them and change the from address to an address of a member in your group with posting permissions.
350 You can use them by executing this command
351
352 mail -s "This is the subject" group_addy@www.example.com < /path/to/civicspace/modules/og2list/testmails/killes/tb-arabic
353
354 To check to see what your groups address, or if your groups address is being properly created. Enter your mysql DB and
355
356 mysql> select * from og2list_groups;
357 +-----+-----------+--------+
358 | nid | recipient | status |
359 +-----+-----------+--------+
360 | 2 | test | 1 |
361 +-----+-----------+--------+
362
363 mail -s "subject line" test@www.example.com < ~/test-mail.txt
364
365 b) check your postfix log to make sure it got there and that the relay is equal to "drupal" - to confirm it was handed to the correct transport. Postfix logs are generally located at '/var/log/mail.log'
366
367 If the message was succesfully recieved and relayed you should have an entry that looks somewhat like. The 3 parts you should look at.
368
369 to= this should be the email address of your group
370 relay = this has to say "drupal", otherwise, your email is being spat out into the ether, never to return.
371 status = this should say sent. if it says deferred or bounced. Make sure the address of your group is correct. see #6, if the address is correct. Check your postfix configuration.
372
373 Jun 8 18:32:16 punlc postfix/pipe[13474]: 6C89A9A1035: to=<mailin@www.example.com>, relay=drupal, delay=16, status=sent (john.localdomain)
374 Jun 8 18:32:16 punlc postfix/qmgr[8473]: 6C89A9A1035: removed
375
376 c) run cron - log in as an administrator on your site and then surf to: http://www.example.com/cron.php
377
378 d) check your mysql query log for INSERTS into og2list_incoming_content and og2list_incoming_groups
379
380 mysql> select * from og2list_incoming_content;
381 mysql> select * from og2list_incoming_groups;
382
383 2) Make sure you created an organic group with a mailing list.
384 mysql> select * from og2list_groups;
385
386 3) Make sure you are an approved member of the group you are trying to send to. That means the mail address you are sending from has to match the one used for your Drupal account.
387
388 4) Check your postfix log (mail.log) for anomalities.
389
390 use this command to continually scroll additions to the log onto the screen.
391
392 tail -f /var/log/mail.log
393
394 Once you have the file tailed. Send a message or two into one of your groups address, or Post a few topics in your groups forums.
395 In a few seconds you should see the messages get processed by postfix and be spit out into the log.
396 Look at the specific values. Make sure to look at status,relay, and the to and from addresses. See (b) above to see specifics on analyzing postfix log entries.
397
398 5) Try to debug from the commandline according to the documentation in
399 mail-in.pl (-d switch):
400
401 TODO: give an exact example with sender and recipient values
402
403 ./mail-in.pl -d -f sender -t recipient < drupal/modules/og2list/testmails/killes/tb-arabic
404
405 sender is an email address of a member of the group which has the
406 local email 'recipient'. Test mails can be found in the testmails
407 directory.
408
409 Make sure to check your postfix log afterwards.
410
411 6) Check to make sure your group has an address. You can do this by using this query in mysql.
412
413 select * from og2list_groups.
414
415 You should see something like
416
417 mysql> select * from og2list_groups;
418 +-----+-----------+--------+
419 | nid | recipient | status |
420 +-----+-----------+--------+
421 | 1 | mailin | 1 |
422 +-----+-----------+--------+
423 1 row in set (0.01 sec)
424
425 In this case the address for that group would be mailin@www.example.com
426 So double check and make sure the group your sending mail to actually has an address.
427
428 the group you are sending mail to should have its address in the recipient column.
429
430 7) I am getting bounces that say "Recipient address rejected: User unknown in local recipient table"
431 Postfix has an otherwise useful feature which only accepts mail to known addresses. We need to switch this off. In /etc/postfix/main.cf add
432
433 local_recipient_maps =
434
435 and restart postfix.
436
437
438 B) No mail is sent to subscribers
439
440 0) Check that your Drupal cronjob is running. Try accessing your installation's cron.php file from your browser.
441
442 a) log in as admin
443 b) goto www.example.com/cron.php in order to manually run your cronjob
444 c) make sure there is an entry in your cronjob that looks something like this:
445
446 */5 * * * * /sw/bin/wget -O - -q http://www.example.com/cron.php
447
448 This cronjob will run every 5 minutes, as denoted by the */5. If yours is not running frequently. This could be the cause of why you havent seen your messages appear in your group forums in a timely manner. On the other hand, you should be wary of setting your cronjob to run any more frequently than every 2 minutes. As two cronjobs running at the same time could cause duplicate messages to be sent out or imported.
449
450 1) Make sure that the group's mailing list is not disabled.
451
452 a)Log in as your groups administrator.
453 b)Under the "My Groups" block, select your group.
454 c)Goto the "Mailing List" Tab on your groups homepage.
455 d)Make sure it is set to "Enabled".
456
457 2) Check if postfix is running.
458
459 There are two ways to test to see if postfix is running
460
461 a) sudo postfix start
462
463 if you see
464
465 postfix/postfix-script: starting the Postfix mail system
466
467 Then postfix was not running.
468
469 or you might see
470
471 postfix/postfix-script: fatal: the Postfix mail system is already running
472
473 Which means it is currently running.
474
475 b) To be really paranoid (sometimes its good to be!). You can check for postfix by doing
476
477 sudo ps aux | grep postfix
478
479 You should see at least a couple of processes owned by postfix. pickup,qmgr,trivial-rewrite, and smtp are all processes called by postfix and are evidence it is running.
480
481 mfa@punlc.local:~$ sudo ps aux | grep postfix
482 mfa 555 1.4 0.0 27368 424 p1 S+ 9:27PM 0:00.00 grep postfix
483 postfix 548 0.0 0.0 27364 740 ?? S 9:26PM 0:00.01 pickup -l -t fifo -u
484 postfix 549 0.0 0.1 27408 804 ?? S 9:26PM 0:00.02 qmgr -l -t fifo -u
485 postfix 550 0.0 0.0 27376 772 ?? S 9:26PM 0:00.01 trivial-rewrite -n rewrite -t unix -u
486 postfix 551 0.0 0.1 27460 836 ?? S 9:26PM 0:00.02 smtp -t unix -u
487 postfix 553 0.0 0.0 27388 764 ?? S 9:26PM 0:00.01 bounce -z -n defer -t unix -u
488
489 3) Do the settings in mail.conf match your database and exim
490 configuration?
491
492 Your $mail_domain is simply the domain of the site where you are running og2list. if your sites address is "www.example.com" your $mail_domain should look something like:
493 # The domain that is appended to the ogroup-specific localparts.
494 $mail_domain = "example.com";
495
496 Your $dbtype will not change. it should be "mysql".
497 # Connection parameters to the Drupal database
498 # type of database connection
499 $dbtype = "mysql";
500
501 These are your DB settings. See below for how to test them.
502 # name of your database server
503 $dbase = "og2list";
504 # name of your Drupal database
505 $dbhost = "localhost";
506 # name of your database user
507 $dbuser = "og2listuser";
508 # the user's password for your database server
509 $dbauth = "og2listpass";
510
511 To test your db connection fill in the the parameter name with its value from your mail.conf. If you successfully make a connection its correct, otherwise. its wrong. pay careful attention to the -p. theres no space between the -p and the value for a reason.
512 mysql -u og2listuser -h localhost -pog2listpass og2list
513
514 # Path to sendmail binary
515 $sendmail_binary = "/usr/sbin/sendmail";
516
517 to find sendmail do
518 whereis sendmail
519 and you should get a result back saying the location of sendmail.
520 /usr/sbin/sendmail
521
522 4) Try to run mail-out.pl from the commandline. An error message should be printed. Show it to your system administrator.
523
524 Switch to your og2list user and run mail-out.pl
525 sudo su og2list
526 ./mail-out.pl
527
528 5) Check you postfix log (mail.log) for anomalities.
529
530 C) I sent mail to my group but cant see it!
531
532 1) Check under admin >> content to make sure your posts are coming in 'unpublished'
533
534 2) See above for checking your mail.log to make sure that the mail is being recieved and processed correctly.
535

  ViewVC Help
Powered by ViewVC 1.1.2