<<O>>  Difference Topic SendMailAndCyrus (r1.5 - 19 Dec 2004 - TWikiGuest)

META TOPICPARENT WebHome

Part 1: Installing CyrusImapd?

Line: 148 to 148

Test your new setup immediately. If anything went wrong, you could possibly be losing mail. If it isn't verifiably working at this point, type cd /etc/mail; make stop to stop SendMail until you either correct the problem or revert to a previous working setup.

-- KirkStrauser - 03 Jul 2003

Added:
>
>

Alternative recipies

It is possible to make sendmail check existence of cysus mailboxes before replying to "RCPT TO:". The required configuration is described at Real Time Cyrus (and sendmail) Integration Version 2

Andrzej Adam Filip 2004-12-19


META FORM ClassForm  
META FIELD TopicClassification TopicClassification SystemAdministration
META FIELD OsVersion OsVersion All
 <<O>>  Difference Topic SendMailAndCyrus (r1.4 - 22 Nov 2003 - KirkStrauser)

META TOPICPARENT WebHome

Part 1: Installing CyrusImapd?

Line: 43 to 43

If you want to use Cyrus to deliver mail locally (and most people do):

Changed:
<
<
  • Edit your SendMail? config file. Locate the MAILER(local) line near the bottom. Just before that line, insert two new lines:
>
>
  • Edit your SendMail config file. Locate the MAILER(local) line near the bottom. Just before that line, insert two new lines:

define(`confLOCAL_MAILER',`cyrusv2')
MAILER(cyrusv2)
Line: 64 to 64

A Note About SpamAssassin

If you want to use SpamAssassin with your new setup, then follow the instructions at FilterMailWithSpamAssassin to install it.

Changed:
<
<
I highly recommend using the FilterMailWithSpamAssassinViaMilter method of using a SendMail? "milter" to process your mail.
>
>
I highly recommend using the FilterMailWithSpamAssassinViaMilter method of using a SendMail "milter" to process your mail.

It's far easier to configure and is completely independent of your SendMailAndCyrus setup. However, if you have a firmly entrenched ProcMail? setup, then you'll want to work through the following directions.

Using ProcMail for local delivery with SpamAssassin

Line: 78 to 78

SendMail? configuration

Changed:
<
<
  • Edit your SendMail? config file. Locate the MAILER(local) line near the bottom. Just before that line, insert a new lines:
>
>
  • Edit your SendMail config file. Locate the MAILER(local) line near the bottom. Just before that line, insert a new lines:

FEATURE(local_procmail)
Line: 145 to 145

Part 3: Testing!

Changed:
<
<
Test your new setup immediately. If anything went wrong, you could possibly be losing mail. If it isn't verifiably working at this point, type cd /etc/mail; make stop to stop SendMail? until you either correct the problem or revert to a previous working setup.
>
>
Test your new setup immediately. If anything went wrong, you could possibly be losing mail. If it isn't verifiably working at this point, type cd /etc/mail; make stop to stop SendMail until you either correct the problem or revert to a previous working setup.

-- KirkStrauser - 03 Jul 2003

META FORM ClassForm  
 <<O>>  Difference Topic SendMailAndCyrus (r1.3 - 03 Jul 2003 - KirkStrauser)

META TOPICPARENT WebHome

Part 1: Installing CyrusImapd?

Line: 61 to 61

/etc/mail# make; make install; make restart
Changed:
<
<

Using ProcMail for local delivery

>
>

A Note About SpamAssassin

If you want to use SpamAssassin with your new setup, then follow the instructions at FilterMailWithSpamAssassin to install it. I highly recommend using the FilterMailWithSpamAssassinViaMilter method of using a SendMail? "milter" to process your mail. It's far easier to configure and is completely independent of your SendMailAndCyrus setup. However, if you have a firmly entrenched ProcMail? setup, then you'll want to work through the following directions.

Using ProcMail for local delivery with SpamAssassin


ProcMail cannot deliver directy to a CyrusImapd? mail folder. However, you can configure it to use cyrus' deliver program to handle the actual delivery.

Line: 139 to 145

Part 3: Testing!

Changed:
<
<
Test your new setup immediately. If anything went wrong, you could possibly be losing mail. If it isn't verifiably working at this point, type cd /etc/mail; make stop to stop SendMail? until you either correct the problem or revert to a previous working setup.

-- KirkStrauser - 01 Apr 2003

>
>
Test your new setup immediately. If anything went wrong, you could possibly be losing mail. If it isn't verifiably working at this point, type cd /etc/mail; make stop to stop SendMail? until you either correct the problem or revert to a previous working setup.

Added:
>
>
-- KirkStrauser - 03 Jul 2003

META FORM ClassForm  
META FIELD TopicClassification TopicClassification SystemAdministration
META FIELD OsVersion OsVersion All
 <<O>>  Difference Topic SendMailAndCyrus (r1.2 - 03 Apr 2003 - KirkStrauser)

META TOPICPARENT WebHome

Part 1: Installing CyrusImapd?

Line: 69 to 69

If you need to use ProcMail to sort your mail, then:

Added:
>
>

SendMail? configuration


  • If you haven't already done so, create a LocalSendmailConfiguration.
  • Edit your SendMail? config file. Locate the MAILER(local) line near the bottom. Just before that line, insert a new lines:


Line: 81 to 83

MAILER(local) MAILER(smtp)
Added:
>
>

Create the spam-processing pipe

Choose your approach. You can either create your own wrapper for spamc and deliver, or you can use mailcheck.py from SpamAssassin. Advantage of the first option: you don't have to have Python installed on the server. Advantage of the second option: it's easier, and spamcheck.py uses lmtp to deliver the email directly to cyrus instead of calling the deliver program. This allows you to use some of CyrusImapd?'s nifty features, such as SortingMailWithSieve?.

Option 1: Roll-your-own solution with spamc and deliver


# cat /usr/local/etc/procmailrc
Line: 99 to 108

formail -I"From " | spamc -u $LOGNAME | /usr/local/cyrus/bin/deliver -a $LOGNAME -m user.$LOGNAME
  • Make procmail-cyrus-delivery.sh executable: chmod a+x /usr/local/bin/procmail-cyrus-delivery
Added:
>
>

Option 2:

# cd /usr/ports/mail/p5-Mail-Sp
# make extract
# cp work/Mail-SpamAssassin-2.50/contrib/spamcheck.py /usr/local/bin/
# make clean

# cat /usr/local/etc/procmailrc
DROPPRIVS=no

:0fw

| /usr/local/bin/spamcheck.py -s nobody -r $LOGNAME -l unix:/var/imap/socket/lmtp

Putting the new setup into action


  • Install your new configuration:
/etc/mail# make; make install; make restart
 <<O>>  Difference Topic SendMailAndCyrus (r1.1 - 01 Apr 2003 - KirkStrauser)
Line: 1 to 1
Added:
>
>
META TOPICPARENT WebHome

Part 1: Installing CyrusImapd?

Installing CyrusImapd? on FreeBSD is pretty simple:

  1. portinstall mail/cyrus-imapd2
  2. Edit /usr/local/etc/imapd.conf to suit your needs (the defaults are probably sufficient)
  3. Run the /usr/local/cyrus/bin/mkimap command to build the appropriate file hierarchy
  4. Set the password of the cyrus user: passwd cyrus
  5. Start the imapd and sasl services:
    • /usr/local/etc/rc.d/imapd.sh start
    • /usr/local/etc/rc.d/sasl.sh start
  6. su cyrus
  7. cyradm localhost and use the password you just defined
  8. Use the cm command inside cyradm to create all of the mailboxes you want to use. Example: cm user.somemailuser
  9. Quit cyradm
  10. Use /usr/local/bin/saslpasswd2 to set passwords on the accounts you just created. Example: saslpasswd2 -c somemailuser

Now you can test this by creating a simple mail file:

# cat testmail
To: somemailuser
From: someoneelse
Subject: Test email

This is a test

and sending it to cyrus' deliver program:

# cat testmail | /usr/local/cyrus/bin/deliver -a somemailuser -m user.somemailuser

Then, use any standard mail client (or telnet, if you prefer) to verify that the email was delivered to somemailuser's account.

Part 2: Configuring Sendmail

Using Cyrus for local delivery

If you want to use Cyrus to deliver mail locally (and most people do):

  • If you haven't already done so, create a LocalSendmailConfiguration.
  • Edit your SendMail? config file. Locate the MAILER(local) line near the bottom. Just before that line, insert two new lines:
define(`confLOCAL_MAILER',`cyrusv2')
MAILER(cyrusv2)
  • Your new configuration file should look something like this:
/root# cd /etc/mail; tail -n 4 host.domain.com.mc
define(`confLOCAL_MAILER',`cyrusv2')
MAILER(cyrusv2)
MAILER(local)
MAILER(smtp)
  • Install your new configuration:
/etc/mail# make; make install; make restart

Using ProcMail for local delivery

ProcMail cannot deliver directy to a CyrusImapd? mail folder. However, you can configure it to use cyrus' deliver program to handle the actual delivery.

If you're using ProcMail to send email through SpamAssassin before delivery, read the SpamAssassinAndCyrus topic and then follow the steps below.

If you need to use ProcMail to sort your mail, then:

  • If you haven't already done so, create a LocalSendmailConfiguration.
  • Edit your SendMail? config file. Locate the MAILER(local) line near the bottom. Just before that line, insert a new lines:
FEATURE(local_procmail)
  • Your new configuration file should look something like this:
/root# cd /etc/mail; tail -n 3 host.domain.com.mc
FEATURE(local_procmail)
MAILER(local)
MAILER(smtp)
# cat /usr/local/etc/procmailrc
DROPPRIVS=no

:0fw
| /usr/local/bin/procmail-cyrus-delivery.sh $LOGNAME
  • Create /usr/local/bin/procmail-cyrus-delivery.sh. The example below includes an inline call to spamc (from SpamAssassin), which is the original problem I was trying to solve by using ProcMail in this setup.
# cat /usr/local/bin/procmail-cyrus-delivery.sh
#!/bin/sh

LOGNAME=$1

formail -I"From " | spamc -u $LOGNAME | /usr/local/cyrus/bin/deliver -a $LOGNAME -m user.$LOGNAME
  • Make procmail-cyrus-delivery.sh executable: chmod a+x /usr/local/bin/procmail-cyrus-delivery
  • Install your new configuration:
/etc/mail# make; make install; make restart

Part 3: Testing!

Test your new setup immediately. If anything went wrong, you could possibly be losing mail. If it isn't verifiably working at this point, type cd /etc/mail; make stop to stop SendMail? until you either correct the problem or revert to a previous working setup.

-- KirkStrauser - 01 Apr 2003

META FORM ClassForm  
META FIELD TopicClassification TopicClassification SystemAdministration
META FIELD OsVersion OsVersion All
View topic | Diffs | r1.5 | > | r1.4 | > | r1.3 | More
Revision r1.1 - 01 Apr 2003 - 22:04 - KirkStrauser
Revision r1.5 - 19 Dec 2004 - 17:18 - TWikiGuest