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 "user@example.com" | |
there with pass "password" | |
mda "msmtp -a user@example.com -- destination@example.com" | |
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 user@example.com | |
host mail.example.com | |
port 587 | |
protocol smtp | |
auth on | |
from user@example.com | |
user user@example.com | |
tls on | |
tls_starttls on | |
account default : user@example.com | |
# Add a new password to your keychain for smtp://mail.example.com with username user@example.com |
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 user@example.com | |
# and forward them to destination@example.com. 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('user@example.com', '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