Created
April 11, 2022 15:50
-
-
Save ianmartorell/47849bbda739a43d387ac10b23be2ab2 to your computer and use it in GitHub Desktop.
Forward all emails in mailbox with folders
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# ~/.fetchmailrc | |
poll mail.privateemail.com | |
with proto IMAP | |
uidl | |
user "[email protected]" | |
there with pass "password" | |
mda "msmtp -a [email protected] -- [email protected]" | |
folders "INBOX", "INBOX/Folder 1", , "INBOX/Folder 2" | |
ssl | |
keep |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defaults | |
tls on | |
logfile ~/.msmtp.log | |
account [email protected] | |
host mail.example.com | |
port 587 | |
protocol smtp | |
auth on | |
from [email protected] | |
user [email protected] | |
tls on | |
tls_starttls on | |
account default : [email protected] | |
# Add a new password to your keychain for smtp://mail.example.com with username [email protected] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Fetchmail will go through all unseen emails in the specified folders of [email protected] | |
# and forward them to [email protected]. You can use the python script to mark all | |
# emails in a folder as unread. Fetchmail will mark them as read as they are forwarded. | |
fetchmail |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from imap_tools import MailBox, MailMessageFlags, A | |
with MailBox('mail.example.com').login('[email protected]', 'password', 'INBOX/Folder name') as mailbox: | |
mailbox.flag(mailbox.uids(A(seen=True)), MailMessageFlags.SEEN, False) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment