SendmailTips

From Request Tracker Wiki
Jump to navigation Jump to search

RT performance and sendmail config

When RT needs to send an email message (notification, autoreply or error to RT owner) it runs the sendmail command, pipes the output to the program, and waits for the sendmail process to exit. This means that RT might delay on any actions that send emails (create ticket, comment or correspond...). The sendmail Delivery Mode option allows you to change this behaviour. This option has four values: i(nteractive), b(ackground), q(ueue), d(efer). The last two modes don't send emails immediately, but put them in the sendmail queue, returning control to RT. You also need to configure how often the sendmail daemon scans the queue, this would define maximum time mails stay in the queue before processing. Ok, lets write it down to config files:

# RT_SiteConfig.pm, *don't forget* to copy defaults from RT_Config.pm
 Set( $SendmailArguments, "-ODeliveryMode=q ...other options..." );
 
 # sendmail daemon options, for example in gentoo located in /etc/conf.d/sendmail
 SENDMAIL_OPTS="-q1m ...other options..." # value could be -q3m, -q30s or even -q1h23m9s
 
 

See also man sendmail, options -O* and -q*.

Configuring sendmail on !RedHat and Fedora

This was done on RedHat 9 but should apply to previous versions as well as Fedora.

By default Sendmail will not accept mail from outside of localhost so there are a number of things you need to change before it will deliver mail to RT.

1) First You need to uncomment the local loopback line to look as follows:

# vi /etc/mail/sendmail.mc
 dnl DAEMON_OPTIONS(`Port=smtp,Addr=127.0.0.1, Name=MTA')
 

To finalize your changes run:

# m4 /etc/mail/sendmail.mc > /etc/mail/sendmail.cf
 

2) You also need to add your mail server to the access list to be able to relay mail to your rt server:

# vi /etc/mail/access
 1.2.3.4	      RELAY
 

You then need to rewrite the access DB:

# makemap hash /etc/mail/access.db < /etc/mail/access
 

3) Now add an entry for the rt server alias:

# vi /etc/mail/local-host-names
 rt.mydomain.com
 

4) If smrsh is used (it is by default usually)

ln -s /opt/rt3/bin/rt-mailgate /etc/smrsh/rt-mailgate

5) Finally restart Sendmail

# service sendmail restart
 

For a management-free method of adding new queues without having to touch sendmail's configuration, look at SendmailWithoutQueueAliases.