Skip to main content

IMAP-to-SMTP relay: imaprelay relays messages from an IMAP INBOX to an SMTP server

Project description

imaprelay is a simple tool designed to scratch a very specific itch. Presented with an institutional email account that he had an obligation to check, but lacking desire to use the Outlook Web Access interface, the author was dismayed to find that he was unable to forward his email.

The solution is imaprelay, a python program that logs into an IMAP account and relays emails from the Inbox to a specified email address, via an SMTP server. Once relayed, emails are “archived” – moved out of the inbox into a different folder.

Although usable programmatically [1], it is expected that most people will want to use the imaprelay command-line tool that this package provides.

By default, this program will look for a configuration file in ~/.secret/imaprelay.cfg – its location should indicate that it needs to contain plain-text passwords for IMAP and SMTP servers, and thus the program will exit immediately if the file is group- or world-readable.

The available configuration options are listed below:

# IMAP server connection details
[imap]
hostname=imap.exchange.megacorp.com
username=j.bloggs
password=123password

# SMTP server connection details
[smtp]
hostname=mail.recipient.com
username=joe_bloggs
password=passw0rd

# Relay configuration
[relay]
# Who should we relay the emails to?
to=onward@recipient.com
# Where should we look for emails to be relayed?
inbox=INBOX
# Where should we move the emails once successfully relayed?
archive=Archive

Once you’ve written a config file, all you need to do is run:

imaprelay

For verbose logging, use:

imaprelay -v

Bug reporting

Please report bugs on Github.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

imaprelay-0.0.1.tar.gz (4.9 kB view details)

Uploaded Source

File details

Details for the file imaprelay-0.0.1.tar.gz.

File metadata

  • Download URL: imaprelay-0.0.1.tar.gz
  • Upload date:
  • Size: 4.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for imaprelay-0.0.1.tar.gz
Algorithm Hash digest
SHA256 5eaaaaaf939056fdf2fdb2afd2cbfabdcbe1d6ee236a050d4515c6527b2efeee
MD5 855f18083e29d8692a6f9250ee58806e
BLAKE2b-256 b44b92ab5d100ca3ec98c13a384d72db4d369ed86a0965e6c69e8f6be8970aed

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page