0

This is my first post on this site, so bare with me if the question is unclear or maybe allready answered (I've looke for several days, but no luck)

Situation: I need to download an entire mailbox from a bussiness email address (in ex.: my.name@my_company.com). The email is in office365, and the authorization is Active Directory controlled by company IT department. :-)

I've tried to use OFFLINEIMAP, which worked well up to a certain point, where some folder name got a bit 'out-of-bounds' in the eyes of OFFLINEIMAP :) This could - of course - be fixed by changing the name of the folder causing the problem, but there seems to be a greater number of those folders. This might be the time to say, that the mailbox in question is approx 37GB and contains a rather large amount of subfolders...

Does any of You intelligent species ever worked with another way to do this?!?

MUTT can log into the mailbox, but how can I script my way to success, so that all the emails is ending up on my HDD ??

ANY solution is wellcome :)

1 Answer 1

0

Well - I found an answer!!! :) Remember, I ONLY wanted to Download emails - not upload anything to the mailbox, or change anything... I found that MBSYNC could do the job for me :)

sudo apt-get install mbsync

vi ~/.mbsyncrc

paste:

IMAPAccount gmail
# Address to connect to
Host TheEmailServer...
User MyUserName4TheMailBox
Pass MyPassWord4TheMailBox
UseIMAPS yes
#SSLType IMAPS
#SSLVersion TLSv1.2
CertificateFile /etc/ssl/certs/ca-bundle.crt
PipelineDepth 1
# To store the password in an encrypted file use PassCmd instead of Pass
# PassCmd "gpg2 -q --for-your-eyes-only --no-tty -d ~/.mailpass.gpg"
#
# Use SSL
# AuthMechs *
# SSLType IMAPS
# SSLVersions TLSv1 TLSv1.1 TLSv1.2
# The following line should work. If get certificate errors, uncomment the two following lines and read the "Troubleshooting" section.
#CertificateFile /etc/ssl/certs/ca-certificates.crt
#CertificateFile ~/.cert/imap.gmail.com.pem
#CertificateFile ~/.cert/Equifax_Secure_CA.pem

IMAPStore gmail-remote
Account gmail

MaildirStore gmail-local
#Subfolders Verbatim
# The trailing "/" is important
Path ~/.mail/my_local_mailbox_folder/
#Inbox ~/.mail/didnt_work_for_me

Channel gmail
Master :gmail-remote:
Slave :gmail-local:
# Exclude everything under the internal [Gmail] folder, except the interesting folders
#Patterns * ![Gmail]* "[Gmail]/Sent Mail" "[Gmail]/Starred" "[Gmail]/All Mail"
# Or include everything
Patterns *
# Automatically create missing mailboxes, both locally and on the server
Create Both
# Save the synchronization state files in the relevant directory
Sync Pull
SyncState *

Then run "mbsync gmail" where 'gmail' is the name from the ~/.mbsyncrc above

Then wait for all the emails to arrive :)

NB: It took a couple of days for me to get them all to complete, and I had to restart the sync a couple of times :)

Please don't forget to 'like' this, if it's usefull to You :)

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .