Professional Web Applications Themes

Mail Configuration - Linux Setup, Configuration & Administration

The family uses a single machine and shares a common POP account. I've tried to symlink all of the Mail folders to a single user, but that causes other problems especially if a user isn't using the same mail client and the use of filters, new mail boxes, etc. So I think using fetchmail is a better route. I want fetchmail to download the mail to a spool where procmail can then copy the mail to all users. Now, I can run fetchmail, but it brings the mail into a spool for the user who is running the fetchmail. How ...

  1. #1

    Default Mail Configuration

    The family uses a single machine and shares a common POP account. I've
    tried to symlink all of the Mail folders to a single user, but that causes
    other problems especially if a user isn't using the same mail client and
    the use of filters, new mail boxes, etc. So I think using fetchmail is a
    better route. I want fetchmail to download the mail to a spool where
    procmail can then copy the mail to all users.

    Now, I can run fetchmail, but it brings the mail into a spool for the user
    who is running the fetchmail. How do I configure fetchmail to:

    1) start as a daemon whenever the machine boots

    2) store the messages in a spool where procmail doesn't have trouble
    getting the messages out of the spool due to access rights

    A question about Procmail, which I didn't see in the man pages, is when
    copying the nessages to a user, does it delete the original from the
    spool?


    Can I use the fetchmail multidrop capability to drop the same messages
    into each users spool? Then I could bypass procmail and have the user's
    clients take directly from their spools.

    Any help appreciated.

    Bign Guest

  2. #2

    Default Re: Mail Configuration


    "Bign" <com> wrote in message
    news:com... 

    Run it out of cron: how best to do this depends on your distribution.

    Alternatively, create an init script in /etc/rc.d/init.d/start-fetchmail,
    and read up on how to use "chkconfig" to set it up correctly.
     

    Create a shared user on your machine that gets all this mail, and which your
    family has the password for. Then run POP or IMAP services on your machine
    to allow your family members to access it from their own personal accounts.
     

    "That depends(tm)".
     

    You can use a ".forward" with something like

    "\myaccount, \momaccount, \sisaccount, \dadaccount"


    Nico Guest

  3. #3

    Default Re: Mail Configuration

    Bign <com> wrote:

    [..]
     

    Just setup some alias, assuming sendmail /etc/aliases containing
    all users and deliver mail to this alias via fetchmail, sendmail
    will do the rest for you. Don't forget to issue 'newaliases'
    after editing /etc/aliases. AFAIR the same can be done with
    postfix and probably others, check the docs, if you are running
    another MTA.

    Good luck

    --
    Michael Heiming

    Remove +SIGNS and www. if you expect an answer, sorry for
    inconvenience, but I get tons of SPAM
    Michael Guest

  4. #4

    Default Re: Mail Configuration

    On Sun, 23 Nov 2003 10:25:54 -0500, Bign <com> wrote: 

    You must mean that everyone has a different email address on the same
    POP server..??

    Assuming so, assuming so, here's what I would do:
    Create a ~/.fetchmailrc for everyone.

    Write a crontab like so: */30 * * * * /usr/local/bin/checkmail%

    which will run the script "checkmail" every 30 minutes.


    Let cron be the daemon.....

    You can put the script with your other startup scripts (a subject in
    itself) to run when you boot up, but you wouldn't want to do both
    without some safeguards built into the one running at boottime to
    prevent it from running at the same time the cronjob was.

    #!/bin/sh

    # checkmail

    su - username -c fetchmail

    su - nextusername -c fetchmail

    # and so forth

    exit 0


    Alan Guest

  5. #5

    Default Re: Mail Configuration


    "Michael Heiming" <michael+heiming.de> wrote in message
    news:heiming.de... 
    >
    > Just setup some alias, assuming sendmail /etc/aliases containing
    > all users and deliver mail to this alias via fetchmail, sendmail
    > will do the rest for you. Don't forget to issue 'newaliases'
    > after editing /etc/aliases. AFAIR the same can be done with
    > postfix and probably others, check the docs, if you are running
    > another MTA.
    >
    > Good luck[/ref]

    He still needs to get the fetchmail to pull the mail in for *that alias*,
    not for another local user or root. If he happens to try pulling mail for,
    say, "bign", and sets up an alias that points to the bign account as well as
    his family's other local accounts, that way lies severe brokenness.

    But the aliases approach is a good one, I like it.


    Nico Guest

  6. #6

    Default Re: Mail Configuration

    On Sun, 23 Nov 2003 10:25:54 -0500, Bign <com> wrote: 

    You must mean that everyone has a different email address on the same
    POP server..??

    Assuming so, here's what I would do:
    Create a ~/.fetchmailrc for everyone.

    poll pop.yourisp.net
    tracepolls
    proto pop3
    user "yourusername"
    pass "yourpassword"
    is yourloginname here
    and wants mda "/usr/bin/formail -ds /usr/bin/procmail"
    fetchall


    Now, you will need to put this near the bottom of everyone's .bashrc:

    if ! ps a | grep [p]ppd &> /dev/null ; then pon && sleep 60 ; fi

    fetchmail

    This assumes that pon is the command you use to connect to the internet.

    Now, alias fetchmail to fm, to make it easy for people to check their
    mail when they want to. In your .bashrc put:

    alias fm='fetchmail'

    Now they can just type fm at the prompt and their mail will be checked
    again.

    You can create a crontab to check every user's mail every 30 minutes,
    say, like this:

    */30 * * * * /usr/local/bin/checkmail%

    #!/bin/sh

    # checkmail

    if ! ps a | grep [p]ppd &> /dev/null ; then

    su - username -c fetchmail &&

    su - username2 -c fetchmail &&

    # etc.

    else exit 0

    fi

    exit 0
     [/ref][/ref]
    that su will work from within it...Never tried it.

    Wait to see what other's here say about it.

    Now, the first user to login will connect your box to the internet and
    check their own mail; the rest will just have their mail downloaded
    when they login. Then, the mail will be downloaded for everyone every
    30 minutes.

    HTH


    AC



    Alan Guest

  7. #7

    Default Re: Mail Configuration

    Nico Kadel-Garcia <net> wrote:
     
    [..] [/ref]
    [..] 
    Yep.
     

    Fail to see the problem, it doesn't matter which user runs
    fetchmail or as daemon as long as you hand it over to the alias
    sendmail will do the rest.
     

    Thx, IMHO the easiest, beside using .forward. Sure there are
    other ways, through .procmailrc or alike. But then, why waste
    time if you have root.
    ;)

    --
    Michael Heiming

    Remove +SIGNS and www. if you expect an answer, sorry for
    inconvenience, but I get tons of SPAM
    Michael Guest

  8. #8

    Default Re: Mail Configuration


    This was a rough draft that "got away" because of the cron job that
    checks mail and news I have running.

    Have pulled it from the server. Please ignore. Sorry.

    On Sun, 23 Nov 2003 23:50:58 GMT, Alan Connor <yyy> wrote: 
    >
    > You must mean that everyone has a different email address on the same
    > POP server..??
    >
    > Assuming so, assuming so, here's what I would do:
    > Create a ~/.fetchmailrc for everyone.
    >
    > Write a crontab like so: */30 * * * * /usr/local/bin/checkmail%
    >
    > which will run the script "checkmail" every 30 minutes.
    >
    >
    > Let cron be the daemon.....
    >
    > You can put the script with your other startup scripts (a subject in
    > itself) to run when you boot up, but you wouldn't want to do both
    > without some safeguards built into the one running at boottime to
    > prevent it from running at the same time the cronjob was.
    >
    > #!/bin/sh
    >
    > # checkmail
    >
    > su - username -c fetchmail
    >
    > su - nextusername -c fetchmail
    >
    > # and so forth
    >
    > exit 0
    >
    >[/ref]
    Alan Guest

  9. #9

    Default Re: Mail Configuration

    On Mon, 24 Nov 2003 00:10:21 +0000, Alan Connor wrote:
     
    >
    > You must mean that everyone has a different email address on the same
    > POP server..??
    >[/ref]

    Nope. Everyone shares the same email address.
    Bign Guest

  10. #10

    Default Re: Mail Configuration

    On Tue, 25 Nov 2003 22:58:05 -0500, Bign <com> wrote: 
    >>
    >> You must mean that everyone has a different email address on the same
    >> POP server..??
    >>[/ref]
    >
    > Nope. Everyone shares the same email address.[/ref]

    I put a lot of work into that post. You should have said "thank you".

    Good-bye


    AC

    Alan Guest

  11. #11

    Default Re: Mail Configuration

    Bign wrote: 
    >>
    >>You must mean that everyone has a different email address on the same
    >>POP server..??
    >>[/ref]
    >
    >
    > Nope. Everyone shares the same email address.[/ref]

    I don't know if this will help, but I solved this sort of problem a bit
    differently.

    My wife and I share a "public" email address: ca
    I wanted to set up some way to keep our email seperate, even though all email
    would be addressed to out public email address.

    I use fetchmail to retrieve our email from our ISP. Fetchmail drops all the
    incoming email into my server's sendmail process for delivery to the local MDA
    (pop3d). I needed something that would seperate out email destined for my wife
    and drop it into /her/ local pop account, while dropping /my/ email into /my/
    local pop account.

    What I did takes a bit of knowledge about email headers. Specifically,
    although the email address ca is used as the delivery
    address and must be properly recorded in the email TO: header, the TO: header
    /may/ include a "nickname" as well. Thus
    TO:Husband <ca>
    and
    TO:Wife <ca>
    are both delivered to my mailbox at my ISP's mail server, The "Husband" and
    "Wife" portions /may/ be tested programattically.

    When fetchmail drops email into my server's sendmail, sendmail runs procmail
    against each email message. My procmail recipe /looks/ for the "Husband" or
    "Wife" nicknames in the TO: header, and remails the email accordingly.

    The procmail recipe looks like...
    #----------------------------------------------------------------------------#
    # If the email was addressed to our public internet address #
    # Redistribute it to the local mailboxes based on the To: personal name #
    # (bypass this step if we've already preprocessed this piece of mail) #
    #----------------------------------------------------------------------------#
    :0
    * ^TOlpitchersympatico\.ca
    * ! ^X-Loop: mailMyServer
    {
    # add a unique value to the header to prevent email looping
    :0fhw
    | formail -A "X-Loop: mailMyServer"

    # If the To: line says "Husband and Wife" or "Wife and Husband",
    # deliver to both
    :0
    * ^TOhusband
    * ^TOwife
    ! husbands_account,wifes_account

    # If the To: line says "Wife", deliver it to her
    :0
    * ^TOwife
    ! wifes_account

    # If the To: line says "Husband", deliver it to him
    :0
    * ^TOhusband
    ! husbands_account

    # If all else fails, deliver this mail to the husband
    :0
    ! husbands_account
    }


    With this recipe, mail addressed to
    Husband <ca>
    comes to my local pop account, while mail addressed to
    Wife <ca>
    goes to my wifes local pop account, and mail addressed to
    Husband and Wife <ca>
    or
    Wife and Husband <ca>
    is copied to both our seperate local pop accounts.
    Finally, mail addressed to
    ca
    or any variation not explicitly covered is also delivered to my local pop account.

    So, rather than linking /var/spool/mail/* files together and having everyone
    get everyone elses mail, you /might/ be able to use the same technique as I
    did, and give everyone in your family a seperate, private, mail queue with
    proper delivery from the common family email address.


    HTH

    --
    Lew Pitcher

    Master Codewright and JOAT-in-training
    Registered Linux User #112576 (http://counter.li.org/)
    Slackware - Because I know what I'm doing.

    Lew Guest

Similar Threads

  1. Replies: 1
    Last Post: September 21st, 09:51 PM
  2. Geting Mail Messages From IMAP to UNIX mail file ???
    By Ninjaboy in forum PHP Development
    Replies: 0
    Last Post: October 24th, 01:30 AM
  3. #25357 [Com]: Mail() function is loosing cahracters when sending mail
    By dj_canard at yahoo dot com in forum PHP Development
    Replies: 0
    Last Post: September 24th, 02:10 PM
  4. Replies: 2
    Last Post: August 12th, 05:02 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139