Using Sieve to Redirect copies of incoming email to Gmail

This page describes how Sieve rules can be set up to forward copies of all incoming email from a Sieve-compliant mail server to your Gmail account. These instructions will not work if your mail server is not sieve-enabled.

The examples provided below are used on a Mac OS X Server version 10.5 Leopard. Let's assume that the mail account you want to copy-and-forward to is joebloggs@gmail.com, the mailserver is called mail.example.com, that sieveshell is installed, and that you have your password for your mailserver.

  1. Create a file, and enter the following (everything after # is a comment and can be ignored). N.B. Change the redirect email address from that below:
    require["fileinto"]; # This line allows us to use the fileinto command
    if true { # This tells sieve to apply the following rules to all incoming messages
      fileinto "Archive"; # This tells sieve to save copies of all messages to a mailbox called Archive. This can be left at INBOX if you'd prefer
      redirect "joebloggs@gmail.com"; # This tells sieve to redirect every incoming message to joebloggs@gmail.com. Obviously, this must be changed to the email address you want to forward to
    }
  2. Save the file. In this example we will call the file sieve.copytogmail.rule.
  3. Run sieveshell, passing the mailserver as a parameter. You may need to find the location of sieveshell first (on my system this was in /usr/bin/cyrus/sieve/sieveshell). You will be asked for your server password; enter it when prompted. N.B. Change the name of the mail server below to your own mail server's name.
    /usr/bin/cyrus/sieve/sieveshell mail.example.com
  4. Put your new script onto the server
    put sieve.copytogmail.rule

    This will let you know if there are any problems with your script.

  5. Activate your new script
    activate sieve.copytogmail.rule
  6. Now, everything should be working. Send yourself a mail and confirm that it was both filed locally and forwarded correctly.
public/sieveongmail.txt · Last modified: 2008/08/09 14:59 (external edit)
 
Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Noncommercial-Share Alike 3.0 Unported
Recent changes RSS feed Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki