Page 1 of 1

php script for importing emails

Posted: Mon 30. Jan 2023, 03:41
by nobody
For my own needs i've created a little script in php for importing emails from a plesk backup (roundcube) to keyhelp roundcube.

1) Basically you extract an email folder from the plesk backup (e.g. info/Maildir/.Sent/cur) and put it into the script folder.
2) Input a name for the new folder and the "program" will extract all files from the above mentioned directory, rename the files into .eml files and create a .zip archive which can be imported easily into roundcube.

If someone's interested please send me a PM with your email address so i'll send it as i don't want to spam the forum with code that maybe nobody needs.
I check this forum once a week | once every 2 weeks as i'm very busy so please be patient for reply.

Bonus: after finishing importing all emails into the new roundcube i've discovered that a lot of emails cannot be read because of some formatting issue (maybe because they weren't written with an WYSIWYG editor | not formatted in html ?)
To solve the issue i've edited the parameter from
$config['imap_disabled_caps'] = [];
to
$config['imap_disabled_caps'] = ['BINARY'];
in file /home/keyhelp/www/roundcube/config/defaults.inc.php

Re: php script for importing emails

Posted: Mon 30. Jan 2023, 03:59
by Jolinar
nobody wrote: Mon 30. Jan 2023, 03:41 If someone's interested please send me a PM with your email address so i'll send it as i don't want to spam the forum with code that maybe nobody needs.
We have a special forum section for things like modifications and user scripts ->
Modification Corner / Bastelecke

Re: php script for importing emails

Posted: Mon 30. Jan 2023, 06:18
by nobody
Jolinar wrote: Mon 30. Jan 2023, 03:59 We have a special forum section for things like modifications and user scripts ->
Modification Corner / Bastelecke
- Saw the 1st page, it's all in german and i have no idea about german language.
- imo would be good to separate german from english forums.

Just move the topic if you find it more appropriate, np.

Re: php script for importing emails

Posted: Mon 30. Jan 2023, 10:43
by christian.john
I always use a tool called imapsync.

https://github.com/imapsync/imapsync

Once you have installed the script you can use the script even as a website (cgi wrapper on subdomain) syncing mail boxes or mail folder.