Télécharger automatiquement le courrier de Gmail

The fetchmail(1) utility can be used to securely and automatically retrieve e-mail from a Gmail account to a mailbox under your csoft account.

Configuring your Gmail account

Your Gmail account must be first configured to allow POP3 access. Log in to your Gmail account, click on the "Options" icon at the upper right of the screen and select "Mail settings". Click on the "Forwarding and POP/IMAP" tab and under the "POP Download" section, select one of the "Enable POP" options. You can choose to keep, delete, archive or mark as read the messages that have been accessed by POP.

Configuring fetchmail

Open up the file ~/.fetchmailrc in your favorite text editor. Replace myname@mydomain.ext for the local e-mail address you wish to receive the Gmail messages. Also substitute myname@gmail.com and 'secret' for your Gmail e-mail address and password:

  set postmaster "myname@mydomain.ext"
  
  poll pop.gmail.com with proto POP3
      user 'myname@gmail.com' there with password 'secret' is myname@mydomain.ext here options ssl
Running fetchmail

While it is possible to run fetchmail on your regular shell server (specifying the correct SMTP server address with "-S mailXX.csoft.net"), it is best to run fetchmail on the mail server itself.

Log onto your mail server ("mailXX.csoft.net") with SSH using your regular csoft account username and password. Note that this is a different machine containing a mirror copy of your home directory. The mirror is only updated daily so you will probably want to manually copy ~/.fetchmailrc from the main server:

  $ scp yourname@yourserver.csoft.net:.fetchmailrc .

You can then run a verbose fetchmail test:

  $ fetchmail -d0 -vk pop.gmail.com

If all is working fine, open up your crontab:

  $ crontab -e

and add the line:

  */15 * * * *    fetchmail -s

This directive specifies to look for new mail every 15 minutes. You can also substitute the "*/15 * * * *" part for "@hourly" or "@daily". Please make sure not to use an interval smaller than 5 minutes.


Ce site web - © 2012 Hébergement Csoft.net, Inc.
(Nous Rejoindre) (Politique de Confidentialité)
  LPF Valid HTML 4.01 Transitional