Import Emails via IMAP Service
Spider command line tool spider-import
supports importing emails via IMAP
service.
Command line arguments:
-
--api-token
: The API token.Please follow our tutorial API Tokens to either generate a new one, or use an existing one.
Replace
<api-token>
by a real one in our sample commands below. -
--api-endpoint
: [Optional] The endpoint of Spider web server, defaults tohttp://127.0.0.1:8080
(it meansspider-import
is running on Spider server locally).-
API Endpoint is the URL of Spider web API interface,
spider-import
will query it to verify whether email is duplicate, and submit for enqueue if it does not exist. -
If you already request free SSL cert on Spider web UI, Spider will redirect all http traffic to https, hence you must specify endpoint explicitly with https URL. For example,
--api-endpoint https://your-server-name.com
-
-
--host
: The IMAP server address (IP address or FQDN hostname).Replace
mail.example.com
in our sample commands by your real IMAP server address. -
--port
: The port number IMAP service is listening on. Defaults to993
.Do not forget to specify
--ssl
or--tls
argument if secure connection is required.- Port
993
usually uses SSL secure connection, use--ssl
in this case. - Port
143
usually uses TLS / STARTTLS secure connection, use--tls
in this case.
- Port
-
--ssl
(introduced in v2.6.1): Use SSL secure connection. -
--tls
(introduced in v2.6.1): Use TLS secure connection. -
--disable-cert-verify
: Disable ssl cert verification.If your IMAP server doesn't use a valid ssl cert, or you use IP address in
--host
argument, please specify this argument to disable ssl cert verification. -
--user-pw-file
: Specify a text file which contains users and plain passwords. -
--user-file
: Specify a text file which contains end users' login usernames. Usually used with an IMAP master user account. -
--dovecot-master-user
: Dovecot Master User. -
--dovecot-master-password
: Dovecot Master User's plain password. -
--imap-folder
(Introduced in v2.3.0): Import from specified IMAP folder instead of all folders.- Currently only one folder name is supported.
- To import a sub-folder, please specify the full folder path. For example,
import sub-folder
myfolder
underINBOX
, use folder name"INBOX/myfolder"
instead of"myfolder"
. Same to deeper folder likeINBOX/myfolder/3rdfolder
, etc.
Sample usages.
Import with end users' usernames and (plain) passwords
Save the usernames and plain passwords in a text file named user-passwords.txt
in certain format:
- one username and one password per line
- username and password must be separated by one or multiple whitespaces
For example:
user-1@domain.com plain-password-1
user-2@domain.com plain-password-2
Import emails with the text file:
spider-import imap \
--api-token <api-token> \
--host mail.example.com \
--port 993 \
--user-pw-file user-passwords.txt
Import with an IMAP master / admin account
Usually IMAP server (like Dovecot) has a master admin account which has privilege to access all users' mailboxes without knowing users' plain password. We use Dovecot Master User for example here.
If you're running an iRedMail server, please check its official document: Dovecot Master User: Access user's mailbox without owner's password..
Save the usernames in a plain text file named users.txt
, one login username
per line, then import with argument --user-file
:
spider-import imap \
--api-token <api-token> \
--host mail.example.com \
--port 993 \
--dovecot-master-user 'master-user' \
--dovecot-master-password 'master-password' \
--user-file users.txt