create new tag
, view all tags
This page is deprecated -- as I try to create "final" documentation for my email server, anything useful from this page should be moved elsewhere. -- I'm editing to eliminate useless stuff. Some deleted, some still to be considered.

  • This sort of ties in with the above: Do I want to create, for example, separate mailboxes for each mail list on the server and filter things into them with procmail, or do I just want to download all the mail to my "main" mail client and create the separate mailboxes there, using either another copy of procmail or the filtering capabilities of my mail client(s)? (In any case, procmail will run on the mail server, to, at a minimum, create a duplicate email "stream" for Ruth and I, initially consisting of duplicating all messages in the two directions.) The action rules will be like:

# The first one -- doesn't need a lock file (delivering to a file does -- add a colon after the c)

:0 c
! ruth

  • Do I want to set up a cron job (with Postfix set to defer_transports=SMTP) to run say every 10 minutes and:
    • confirm my dial up connection is up (ping and grep) (or attempt to bring it up)
    • run fetchmail
    • run sendmail -q
Or, do I want Postfix to be set to not defer transports (defer_transports=  and not kick the queue with sendmail -q)?

My concern is with the exponential backoff and the possibility of outgoing mail sitting on the server for excessive periods of time.

I guess I'll start by trying to set up IMAP (done) and do some testing (with some large mail files). Simultaneously I'll start working on a script file to run from cron.

UPDATE: IMAP looks usable, and fast enough on my LAN. Started on script -- got some help, getting closer -- some tidbits recorded below.

New questions to ponder:

  • Now that my approach to daily email reading will change (e.g., no longer have to sort each email) what will my habit be? Looks like kmail at least can display mail sorted in forward or reverse date order -- if I keep the newest on top I can read down everyday until I see the previous day's emails, deleting some, saving some, and flagging some of those. Hmm, how are threads handled / displayed? I'll have to try and see.
  • Procmail: Do I want to send Ruth everything I don't otherwise dispose of or do I want to send her only stuff I know belongs to her? (E.g., addressed to ruth <rhkramer@fast.net>.)
  • If I take the second approach, I will surely have to forward some things to ruth that came as a surprise -- I want to see what the most expeditious ways of doing that are.

See ProcmailPlan.

See AboutThesePages.



Some notes about the installation so far:

  • To a great extent, I didn't make many changes to the email server that is "installed by default" on the Mandrake 7.2 system (which includes postfix, with procmail configured as the lda(??), imapd (which flavor?) as the pop3/imap server, and fetchmail to run at intervals and fetch the mail from my ISP. <I should describe (or reference) a description of what I wanted to accomplish with an email server.

  • Although I fooled around with DNS, in the end I do not have and do not need a local DNS server for what I'm doing. Don't even need any MX records (or those I need are already created and stored at my ISP's DNS). Don't even need to specify anything in a hosts file, as I can specify my pop and smtp servers by their IP address.

  • I still might want to learn more, but boy it's simultaneously a relief and a great frustration -- relief that all this is much easier than I expected -- frustration that it took me so long to [realize | figure out | be told] how easy it is.

  • Fetchmail required the addition of a $HOME/.fetchmailrc file in my home directory. (I could have set it up to run as root, I decided to let it run as dad on the presumption that it would be more secure, but I have seen arguments to the contrary.) Here is the contents:

poll pop.fast.net proto POP3 user rhkramer to dad password 'nonsense' keep

  • Postfix required the specification of (in the main.cf file):
    • relayhost=relay.fast.net
    • disable_dns_lookups=yes
    • defer_transports=smtp (maybe!!)

In addition, I will configure my email clients to send out email with a from address of rhkramer@fastPLEASENOSPAM.net (unless I want to send mail locally, then I will use, e.g., dad@system8PLEASENOSPAM.home).

  • Procmail wasn't too hard to set up -- start with the addition of a $HOME/.procmailrc file. I followed instructions found on the site http:// . There are some gotchas related to permissions and so forth -- the normal permission type issues, plus procmail won't trust the .procmailrc if it is world or group writable!! (Mandrake 7.2 is configured so that group writable is OK, IIUC.)

  • pop3 wasn't too hard to set up once I understood a little about xinetd. xinetd refers to a directory containing a "configuration file" for each potential service. Once you turn it on, it seems to pretty much "just work". It seems that ipopd (at least the version in Mandrake 7.2 does not even allow you to choose the users mailbox file location -- it assumes the "default" will be used (not specified in an ipopd configuration file (don't think there is one) but in some other location (maybe the environment, maybe some other file ????))

  • imap was fairly easy to get going -- I enabled imapd in xinetd.d, restarted xinetd, and then was able to just start the Mozilla 0.9.8 mail client, set it for the right IP addresses, and it just worked. This despite the fact that I could not carry on a telnet conversation with the imapd daemon (on ports 143 or 220, following the "script" in Red Hat 6.0 (?) Unleashed) -- maybe I'm using too new a version of imap, and or it is imap4 and on a different port.

  • Aside: Mozilla 0.9.8 did it's thing again -- crashed and took all the open Mozilla windows with it. A good reason not to use the mozilla mail client, nor to use the mail client from any browser / mail / news "suite". I'm hoping the problem is fixed in more recent versions of Mozilla. (The problem is you can't really start independent instances of Mozilla -- when you get a crash it takes all open instances of Mozilla with it (at least it has so far with all three Mozilla crashes I've had). (I wrote this up somewhere else, but with not much more detail than this.)

  • Here's pseudocode for the script I need, and some other tidbits:

       maxtries = 3 (??) 
       count = 0
start: ping ISP (with parameters to limit to say 4 pings instead of continuous)
       count = count + 1
         if icmp echo request == 'yes'
               sendmail -q
               if count <= maxtries (wow, do I forget valid syntax ;-) )
                     wait 30 (??) (give the modem a chance to connect)
                     goto start
                     issue "Internet connection lost, could not restart" message (somewhere)

# Here's a way to ping and see if the modem / interface is up:

ping -c 4 | grep "64 octets" -A 4 | \
grep -c "0% Packet Loss"

STATUS=`ping -c 2 -q 2>/dev/null`
# Here's an alternative:

if [ $CODE -gt 0 ]; then
   echo Link is down.
   echo Link is up.

# Here's an alternative:

ifconfig | grep <interface> -A 2 | grep -c UP 

# Other tidbits:
if [[ `mailq | tee mailq.txt | grep -c 'is empty'` ]] ; then echo \'yes' ; else echo 'no' ;fi
cat mailq.txt

kwan@digitalhermit.com wrote:
>   somecommand > tmpfile.$$
> The $$ expands to the process ID of the command and is useful for
> quickly generating a filename. 

Daniel Woods wrote:
> if [[ `mailq | grep -i 'is empty'` ]] ; then echo 'yes' ;else echo 'no' ;fi

Todd Lyons wrote:
> Close.  How about:
>   unset RESULT
>   RESULT=`mailq | tee logfile.log | grep -c "empty"`
>   [ $RESULT ] && do_whatever_you_need_here

(Some of the above stuff should be moved to a page like BashSnippets, BashIdioms, or BashTidbits -- not sure which, or maybe distribute the stuff "appropriately".)

<Currently, no significant content below this line.>


See ResourceRecommendations. Feel free to add additional resources to these lists, but please follow the guidelines on ResourceRecommendations including ResourceRecommendations#Guidelines_for_Rating_Resources.


  • (rhk) [[][]] --

Recommended for Specific Needs

  • (rhk) [[][]] --

Recommended by Others

  • (rhk) [[][]] --

No Recommendation

  • (rhk) [[][]] --

Not Recommended

  • (rhk) [[][]] --


  • () RandyKramer - 16 Aug 2002
  • <If you edit this page: add your name here; move this to the next line; and include your comment marker (initials), if you have created one, in parenthesis before your WikiName.>

[[Main.RandyKramer#16 Aug 2002][]]

Page Ratings

Edit | Attach | Watch | Print version | History: r5 < r4 < r3 < r2 < r1 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r5 - 2002-09-01 - RandyKramer
  • Learn about TWiki  
  • Download TWiki
This site is powered by the TWiki collaboration platform Powered by PerlCopyright 1999-2017 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding WikiLearn? WebBottomBar">Send feedback
See TWiki's New Look