Category: Mail

  • Migrate Emails using imapcopy

    imapcopy is a program to copy mails from one IMAP mailbox to another. I was using this for email migrations. But for a large mailbox with 9300 mails, this failed. So i looked for alternatives. I installed imapsync, it was little annoying to install as it need lot of other packages installed for it to work. But imapsync worked better than imapcopy.

    To instal imapcopy on Ubuntu/Debian, run

    apt install imapcopy
    

    To migrate mailbox, create a file

    vi ImapCopy.cfg
    

    Create config file

    SourceServer SOURCE_SERVER_IP
    SourcePort 143
    DestServer DESTINATION_SERVER_IP
    DestPort 143
    skipfolder INBOX.Trash
    skipfolder INBOX.Spam
    Copy "[email protected]" "SOURCE_PASSWORD" "[email protected]" "DEST_PASSWORD"
    

    In above file, replace SOURCE and DESTINATION server IP, user and passwords.

    To start the email migration, run

    imapcopy
    

    You can test the config with command

    imapcopy -t
    imapcopy -i
    
  • PowerMTA

    PowerMTA is a highly configurable mail server for email marketing. Unlike general email servers, PowerMTA can be configured to meet your special mail delivery requirements.

    List mails in the queue

    pmta show queues

    To reload PowerMTA

    pmta reload

    PowerMTA config file location

    /etc/pmta/config

    To see mail queue status, run

    pmta show status
  • Install Open Source Zimbra Mail Server

    Install Open Source Zimbra Mail Server

    To install Zimbra, Download the latest version of “Zimbra Collaboration Open Source” form

    https://www.zimbra.com/downloads/

    At the time of this post, the latest version is 8.8.15 GA Release.

    System Requirments

    Zimbra recommends 8 GB of RAM. For detailed system requirements, see Zimbra System Requirements

    I have installed it on servers with 4 GB RAM without any problem. If you are installing on a server with 4 GB RAM, make sure you add swap in cause you run out of RAM.

    dd if=/dev/zero of=/swapfile bs=1M count=4096
    mkswap /swapfile
    chmod 0600 /swapfile
    swapon /swapfile
    echo "/swapfile swap swap defaults 0 0" >> /etc/fstab
    

    Set Hostname

    Zimbra needs you to set the proper hostname for your server.

    hostnamectl set-hostname mail.yourdomain.com
    

    First, add an A record for your hostname and point it to your server IP.

    Now edit /etc/hosts and add an entry like

    IP_ADDR  mail.yourdomain.com mail
    

    Where mail.yourdomain.com is your FQDN.

    Set MX Record

    During installation Zimbra checks for MX records, so make sure you set MX record for your domain, point it to the server where you install Zimbra.

    Install Zimbra on Ubuntu 20.04

    Download the latest version of Zimbra from

    https://www.zimbra.com/downloads/zimbra-collaboration-open-source/

    To install Zimbra, run

    cd /usr/local/src
    wget https://files.zimbra.com/downloads/8.8.15_GA/zcs-8.8.15_GA_4179.UBUNTU20_64.20211118033954.tgz
    tar xvf zcs-8.8.15_GA_4179.UBUNTU20_64.20211118033954.tgz
    cd zcs-8.8.15_GA_4179.UBUNTU20_64.20211118033954
    ./install.sh
    

    It will ask some questions. For most questions, you can just press enter as that is the default option (Y).

    Once install is done, you will be asked to set an admin password.

    After the installation is done, you will be able to login to the Zimbra Admin area at

    https://mail.yourdomain.com:7071/zimbraAdmin/
    

    Webmail available at

    https://mail.yourdomain.com
    

    Zimbra

  • sendgrid

    Sendgrid is a SMTP (Transactional Email Provider).

    https://sendgrid.com

    Sendgrid allow you to send email from your applications using SMTP or API.

    SASL authentication no mechanism available

  • postconf

    postconf allow you to list/change postfix configuration.

    To list current config, run

    postconf -n
    

    To change a configuration, run

    postconf -e home_mailbox=Maildir/
    

    postfix

  • Amazon Workmail Review

    Amazon Workmail is business email hosting like Google G Suite, Office 365, etc..

    https://aws.amazon.com/workmail/

    Workmail cost $4 per user, comes with 50 GB storage.

    It come with all normal access modes like IMAP, POP3, etc..

    Webmail is basic with contacts and Calendar.

    Configuring WorkMail

    You can find instructions to configure email clients at

    https://docs.aws.amazon.com/workmail/latest/userguide/clients.html

    For IMAP/SMTP, see

    https://docs.aws.amazon.com/workmail/latest/userguide/using_IMAP.html

    SMTP works with phpmailer, so you can use it with your website to send emails.

    What is WorkMail webmail URL?

    You can find the Amazon WorkMail webmail URL at

    Amazon WorkMail > Organizations 
    

    Amazon Workmail

    Since i am used to Google G Suite, it feel little hard for me to use.

    One thing i noticed is when i sent email, i used to type recipient email address, press tab, enter subject, tag again, type message. This is the workflow i am used to in Google G Suite. When i try same in Amazon Workmail, it did not work because there are too many elements on the compose email screen and i have to press TAB multiple times to get into subject or body field.

    Amazon Workmail Compose

    All the marked elements here force you to press TAB. After enter recipient, you need to press TAB 3 times to get into subject field, again TAB 4 times before you can start wring the message.

    To get to compose, you need to click “New Item” then select “New email” from drop down menu. That is lot of wasted time on a Mail application where primary purpose is to sent and receive emails. It will be better to have a “Compose” or “New email” button like most other email providers, make easy for users.

    I don’t think i can compare it with Google G Suite as it come with much more features like Google Drive, Documents and many more. But for business use, many of these may not required, it depends on the business.

    aws

  • zmcontrol CLI for Zimbra Mail Server

    zmcontrol is CLI tool for managing Zimbra Mail Server.

    To use, zmcontrol, you need to become user zimbra.

    su - zimbra
    zmcontrol status
    

    To stop zimbraAdmin, run

    zmcontrol stop zimbraAdmin
    

    Example

    [zimbra@mail ~]$ zmcontrol stop zimbraAdmin
    Host mail.serverok.in
    	Stopping zmconfigd...Done.
    	Stopping zimlet webapp...Done.
    	Stopping zimbraAdmin webapp...Done.
    	Stopping zimbra webapp...Done.
    	Stopping service webapp...Done.
    	Stopping stats...Done.
    	Stopping mta...Done.
    	Stopping spell...Done.
    	Stopping snmp...Done.
    	Stopping cbpolicyd...Done.
    	Stopping archiving...Done.
    	Stopping opendkim...Done.
    	Stopping amavis...Done.
    	Stopping antivirus...Done.
    	Stopping antispam...Done.
    	Stopping proxy...Done.
    	Stopping memcached...Done.
    	Stopping mailbox...Done.
    	Stopping logger...Done.
    	Stopping dnscache...Done.
    	Stopping ldap...Done.
    [zimbra@mail ~]$
    

    Zimbra

  • Zimbra

    Login to Zimbra Admin at

    https://YOUR_SERVER_IP:7071/zimbraAdmin/

    Login to webmail at

    https://YOUR_SERVER_IP/

    Installation Tips

    1) Make sure no postfix pre installed.

    2) Set SELinux off

    3) Make sure you can ping to hostname, also MX record set for hostname

    4) Turn firewall off during installation or open required ports.

    Re Run configuration

    /opt/zimbra/libexec/zmsetup.pl
    

    Start Zimbra Server

    zmcontrol start
    

    Location of postfix. If you run command as user zimbra, then this folder is in your path. If running as root, you need to specify full path.

    /opt/zimbra/common/sbin/postqueue
    
  • Zimbra Reset Administrator Password

    To reset Administrator password for Zimbra Mail Server, run

    su - zimbra
    zmprov sp ADMIN_EMAIL NEW_PASSWORD
    

    Zimbra

  • exiqgrep

    exiqgrep allows you to search exim mail queue.

    To search for a particular recipients, run

    exiqgrep -r EMAIL_ADDR_HERE
    

    To search for all emails from a particular email account, use

    exiqgrep -f EMAIL_ADDR_HERE
    

    You can use -i option to list only message id. This is useful when you need to delete mails from a particular account.

    To delete all email sent from a particular email account, run

    exiqgrep -f EMAIL_ADDR_HERE -i | xargs exim -Mrm
    

    To delete all frozen emails from queue, run

    exiqgrep -iz | xargs exim -Mrm
    

    If you have too many emails, then use xargs -P option to specify how many mails to delete at a time

    exiqgrep -iz | xargs -P20 exim -Mrm
    

    This command will delete 20 mails at a time.

    Delete all mails in queue

    To delete all emails in queue run

    exiqgrep -i | xargs -P20 exim -Mrm
    

    exim

  • exiwhat

    exiwhat commands shows what exim mail server is doing.

    [root@server78 ~]# exiwhat
     6415 delivering 1emCxq-0001f7-61: waiting for a remote delivery subprocess to finish
     6428 delivering 1emCxq-0001f7-61 to aspmx3.googlemail.com [209.85.202.26] ([email protected])
     6437 delivering 1emCxq-0001fd-TA: waiting for a remote delivery subprocess to finish
     6452 delivering 1emCxq-0001fd-TA to aspmx3.googlemail.com [209.85.202.26] ([email protected])
     8185 delivering 1emCyw-00021q-MM: waiting for a remote delivery subprocess to finish
     8258 delivering 1emCyw-00021q-MM to alt3.gmail-smtp-in.l.google.com [108.177.15.27] ([email protected])
     9037 delivering 1emCzn-0002LS-NT: waiting for a remote delivery subprocess to finish
     9041 delivering 1emCzn-0002LS-NT to aspmx5.googlemail.com [173.194.79.26] ([email protected])
    11772 delivering 1emD1k-00033V-JM: waiting for a remote delivery subprocess to finish
    11787 delivering 1emD1k-00033V-JM to alt2.aspmx.l.google.com [209.85.203.26] ([email protected])
    11825 delivering 1emCOM-0004kF-WE: waiting for a remote delivery subprocess to finish
    11829 delivering 1emCOM-0004kF-WE to alt2.gmail-smtp-in.l.google.com [209.85.202.26] ([email protected])
    11967 handling TLS incoming connection from (telkomsa.net) [185.62.188.116]:51246
    12631 handling TLS incoming connection from (telkomsa.net) [185.62.188.116]:51247
    12800 handling TLS incoming connection from (telkomsa.net) [185.62.188.116]:51248
    13564 handling TLS incoming connection from (telkomsa.net) [185.62.188.116]:51249
    13667 handling TLS incoming connection from (telkomsa.net) [185.62.188.116]:51250
    14009 handling TLS incoming connection from (telkomsa.net) [185.62.188.116]:51251
    14326 handling TLS incoming connection from (telkomsa.net) [185.62.188.116]:51252
    14446 handling TLS incoming connection from (telkomsa.net) [185.62.188.116]:51253
    14463 delivering 1emD3X-0003lD-2o: waiting for a remote delivery subprocess to finish
    14469 delivering 1emD3X-0003lD-2o to aspmx.l.google.com [74.125.29.26] ([email protected])
    14672 handling TLS incoming connection from (telkomsa.net) [185.62.188.116]:51254
    16096 handling TLS incoming connection from mail-ua0-f187.google.com [209.85.217.187]:39394
    16175 handling TLS incoming connection from (telkomsa.net) [185.62.188.116]:51255
    16556 tidying up after delivering 1emD4s-000371-T9
    16559 accepting a local non-SMTP message from <>
    16622 tidying up after delivering 1emD4u-0003oe-EZ
    16626 accepting a local non-SMTP message from <>
    16663 tidying up after delivering 1emD4v-0003Hj-Ca
    16666 accepting a local non-SMTP message from <>
    16680 handling incoming connection from [74.208.175.54]:52747
    16704 tidying up after delivering 1emD4x-0003YR-On
    16707 accepting a local non-SMTP message from <>
    16709 tidying up after delivering 1emD4y-0003l0-8X
    16714 accepting a local non-SMTP message from <>
    16744 tidying up after delivering 1emD4z-0003dx-AV
    16749 accepting a local non-SMTP message from <>
    16760 tidying up after delivering 1emD4z-0003KS-Kk
    16764 accepting a local non-SMTP message from <>
    16776 tidying up after delivering 1emD50-000371-Ge
    16782 accepting a local non-SMTP message from <>
    16802 tidying up after delivering 1emD54-0003Wm-Sr
    16805 accepting a local non-SMTP message from <>
    16816 tidying up after delivering 1emD55-0003oe-8h
    16824 accepting a local non-SMTP message from <>
    16830 tidying up after delivering 1emD56-0004Ct-0r
    16833 accepting a local non-SMTP message from <>
    16842 handling incoming connection from [212.237.45.48]:50484
    16845 handling incoming connection from [212.237.45.48]:58446
    16854 delivering 1emD5F-0004Nf-6l: waiting for a remote delivery subprocess to finish
    16855 tidying up after delivering 1emD57-0003Hj-Hq
    16860 accepting a local non-SMTP message from <>
    16864 delivering 1emD5F-0004Nf-6l to aspmx.l.google.com [74.125.192.27] ([email protected])
    16870 tidying up after delivering 1emD4y-0004IX-Sd
    16871 tidying up after delivering 1emD57-0003j4-Sf
    16876 accepting a local non-SMTP message from <>
    16890 handling incoming connection from [185.156.173.137]:58672
    23465 running queue: waiting for 1emCOM-0004kF-WE (11825)
    24554 daemon(4.89_1): -q1h, listening for SMTP on port 25 (IPv6 and IPv4) port 587 (IPv6 and IPv4) and for SMTPS on port 465 (IPv6 and IPv4)
    [root@server78 ~]# 
    

    exim