Kompx.com or Compmiscellanea.com

Imapsync. IMAP migration

Operating systems : Linux

Migrating an IMAP account from one IMAP server to another [ 1 ] / Linux, command line:

imapsync --host1 imap.this.com --user1 email@example.com --passfile1 /home/user/imap/passwordfile1 --ssl1 --host2 imap.another.com --user2 email@example.com --passfile2 /home/user/imap/passwordfile2 --ssl2 --skipsize --allowsizemismatch

- There is a web site (example.com) and an email box (email@example.com) hosted at a web hosting company. The IMAP server: imap.this.com. The IMAP server supports SSL.

- The example.com web site is to be transfered to another web hosting company. So is the email@example.com box with all its contents and keeping its folders structure. The IMAP server of another web hosting company: imap.another.com. The IMAP server supports SSL.

1. Set up an email box named email@example.com and a password to it on the server of the web hosting company the email@example.com mailbox is to be transfered to - from the previous web hosting company.

2. Create two text files in /home/user/imap/: passwordfile1 with the password for the mailbox on the first IMAP server and passwordfile2 with the password for the mailbox on the second IMAP server.

3. chmod 600 /home/user/imap/passwordfile1

4. chmod 600 /home/user/imap/passwordfile2

5. Install imapsync

6. Run imapsync

Imapsync transfers a mailbox - keeping its folders structure - from imap.this.com to imap.another.com. SSL is used to enable encryption and passwords are saved to protected files (chmod 600).


Migration between two email service boxes may happen to require to make use of more imapsync options [ 2 ]. Like transfering contents of one Gmail.com box to another demands to have "--port1" and "--port2" specified:

imapsync --host1 imap.gmail.com --port1 993 --user1 email1@gmail.com --passfile1 /home/user/imap/passwordfile1 --ssl1 --host2 imap.gmail.com --port2 993 --user2 email2@gmail.com --passfile2 /home/user/imap/passwordfile2 --ssl2 --skipsize --allowsizemismatch


[ 1 ]

A simple and common case: contents of one email box are transfered to another, empty mailbox. But there can be more complicated ones like: Gmail to Google Apps Email Migration and Moving to Google Apps with imapsync.

[ 2 ]

For more command options: Migrate mail from one server to another with imapsync and imapsync(1) - Linux man page.


Aliosque subditos et thema

 

HTTP to HTTPS redirect in .htaccess

 

Redirecting from all domain names of a web site to its web address with HTTPS and the domain with www. The names to be redirected from are: Both with and without www - URL with HTTP Without www - URL with HTTPS Server configuration: Apache + nginx. SSL is enabled. SSL-certificate is purchased, approved and installed. That is, everything is up and running. So it is just the HTTP to HTTPS redirection that is left to get ready and start up. Directives for .htaccess file: RewriteEngine On RewriteCond %{HTTP:HTTPS} !on [NV] RewriteRule ^(.*)$ https://www.domain.tld/$1 [R=301,L] RewriteCond %{HTTP_HOST} !^www\. RewriteRule ^(.*)$ https://www.domain.tld/$1 [R=301,L] HTTP to HTTPS redirect in detail -- Enable runtime rewriting engine: RewriteEngine On -- If HTTPS is not present: RewriteCond %{HTTP:HTTPS} !on [NV] -- Then replace HTTP + domain (with or without www) with HTTPS + domain with www: RewriteRule ^(.*)$ https://www.domain.tld/$1 [R=301,L] -- If HTTPS is present, but domain name has no www (the case when https://domain.tld is entered in address bar): RewriteCond %{HTTP_HOST} !^www\. -- Then replace it with HTTPS + domain with www: RewriteRule ^(.*)$ https://www.domain.tld/$1 [R=301,L] Notes RewriteCond %{HTTP:HTTPS} !on [NV] is not the only way to detect if HTTPS is not present. Moreover, for some server configurations other directives may be more suitable, like RewriteCond %{SERVER_PORT} !443 for example. The point is to find out somehow if HTTPS is not on. So it should probably be checked by practice what is going to work in a particular case. Apache Module mod_rewrite docs: http://httpd.apache.org/docs/current/mod/mod_rewrite.html

CSS. Target Firefox only

 

CSS targeting Firefox web browser only: This text is red in Firefox HTML / XHTML. Code: <p>This text is red in Firefox</p> CSS. Code: @-moz-document url-prefix() {p {color: #f00;}} Unlike the method of styling elements for Opera browser only, it is essentially a hack - since the rule originally is intended for a different purpose. But lack of support in browsers other than Firefox allows to isolate code for use by Firefox web browser only. [ 1 ] Other browsers with Gecko web browser engine, like SeaMonkey 1.0+ or older Netscape 9.0, also support the hack. [ 2 ] Various versions of Internet Explorer, Google Chrome, Opera, Safari react to the hack as they are meant to - these browsers ignore the whole code of the Firefox specific hack. [ 3 ] There is also one more browser where text gets red - ELinks, an advanced text-based web browser with some support for CSS.