#!/bin/bash
#======================================================================
# Copyright (c) 1997 Daniele Giacomini daniele@pluto.linux.it
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#======================================================================
# posta-remota
#
# Carica la posta da un computer remoto utilizzando il protocollo
# pop-3 e la deposita in un file ``inbox''.
# Non utilizza alcun argomento dalla riga di comando.
#======================================================================

#======================================================================
# Variabili.
#======================================================================

    #------------------------------------------------------------------
    # Il nome del computer dal quale si scarica la posta.
    #------------------------------------------------------------------
    COMPUTER_POP="paperone.zagozigo.it"
    #------------------------------------------------------------------
    # Il mone dell'utente cosi' come e' registrato nel computer POP.
    #------------------------------------------------------------------
    UTENTE="paperino"
    #------------------------------------------------------------------
    # La password per accedere al computer POP.
    #------------------------------------------------------------------
    PASSWORD="sfortuna"
    #------------------------------------------------------------------
    # Il file in cui si vuole che sia depositata la posta scaricata
    # dal computer POP.
    #------------------------------------------------------------------
    INBOX="~/mail/inbox"

#======================================================================
# Inizio.
#======================================================================

    #------------------------------------------------------------------
    # Tenta di caricare la posta dal computer remoto.
    #------------------------------------------------------------------
    if popclient -3 -o $INBOX -u $UTENTE -p $PASSWORD $COMPUTER_POP
    then
        #--------------------------------------------------------------
        # L'operazione e' riuscita, avvisa del successo.
        #--------------------------------------------------------------
        echo "E' stata scaricata posta da $COMPUTER_POP all'interno \
di $INBOX"
    else
        #--------------------------------------------------------------
        # L'operazione non e' riuscita.
        #--------------------------------------------------------------
        echo "Non ci sono messaggi nuovi nel server $COMPUTER_POP."
    fi

#======================================================================
# Fine.
#======================================================================
