Home > Homelab > Using hMailServer in the lab

Using hMailServer in the lab

December 27th, 2014 Leave a comment Go to comments

In a recent training for vCenter Server Orchestrator 5 we had to build a workflow that would leverage an email server to send mails. The lab was more of a theoretical practice as no actual email server was installed and a full blown Exchange is overkill for most homelab scenarios. I also do prefer Windows over any sendmail configuration at any point in time and have discovered hMailServer to be a perfect fit for my lab setups.

The binaries can be downloaded here and a shared under the AGPLv3 license. The server does support the most common email protocols including IMAP, SMTP and POP3. Configuration is easily done via an admin GUI.

After the 4 MB download is finished the installation is done in typical Windows style with “next, next … finish” choosing the embedded database option for my lab purposes and doing a full install to get the admin GUI as well. You will be asked for a password during the installation as well to protect the configuration. The total installation size will result in about 20 MB used disk space, now compare that to Exchange!

The first task after connecting the admin GUI will be to actually create a domain which can easily be done via the Welcome page.

CaptureYou can also create a “catch-all” address in the Advanced tab if you feel like it. You will need to click on “Save” before you can create any mailboxes and users though. This can be achieved by going into the Accounts folder of the freshly created domain and clicking the “Add…” button which will bring up the following dialog. As you can see there is also an Active Directory tab to link your mail account directly to your Active Directory credentials, which is pretty neat.

Capture2

After the accounts are set up you will want to make the sending and receiving for emails to these mailboxes work and there want to open up the Settings to configure the protocols. We therefore add the local hostname to the SMTP settings as shown below, I additionally added the internal interface of the dual homed machine in the advanced settings.

Capture3

As it is a lab I will also deactivate a very annoying security feature which is the autoban. This can be done in the “Settings” -> “Advanced” sub menu. In case I put a wrong password or do spam the server with requests I do not want to get the account locked, which is fine since this server is not available on the internet anyway. If you want to edit the ports or add SSL certificates to the lab setup this would also be the place to configure this.

Capture4

In your Active Directory lab domain you should also add the MX record in the DNS settings.

Capture5

 

Time to test the configuration so far. hMailServer actually does have a small test program built-in. It can be found in the utilities menu. If you are still getting MX record errors consider to do an “ipconfig /flushdns” to update the local DNS cache with the most recent values. You can easily remediate the backup error using the backup menu and specifying a backup location.

Capture6

 

The next confirmation step is to actually try to send an email. No client is needed for this as the “Server sendout” in the “Utilities” allows for that functionality.

Capture7Via the “Status” tab in the “Status” menu we can then confirm, that the email was actually send.

Capture8

 

Furthermore the received email will be saved on the file system in eml format. This proves that the server is fully functional and can now be used in our lab.

Capture9

Just to prove this point I have added the server to the inbound and outbound email server settings in vRealize Automation 6.2.

Capture10

 

After deleting a machine we can easily see that the email spam has begun 🙂

[vrava:/var/log/vmware/vcac # tail -f catalina.out | grep delivery]

2014-12-27 17:08:17,313 vcac: [component=”cafe:notification” priority=”INFO” thread=”queue-pool-executer-1″ tenant=””] com.vmware.vcac.notification.service.impl.NotificationDeliveryStatusServiceImpl.updateNotificationDeliveryStatus:103 – [NotificationId=”2587c094-35d4-4fbd-a033-c812d90a3855″ notificationScenarioId=”csp.catalog.notifications.request.successful” recipient=”Administrator@vcac.local” provider=”EMAIL_PROVIDER” serviceId=”null” tenantId=”vsphere.local”] Updated notification delivery status for recipient to [SENT]
2014-12-27 17:08:17,326 vcac: [component=”cafe:notification” priority=”INFO” thread=”queue-pool-executer-1″ tenant=””] com.vmware.vcac.notification.service.impl.NotificationDeliveryStatusServiceImpl.updateNotificationDeliveryStatus:175 – count recipient Delivery Statuses: RecipientDeliveryStatus [recipientId=Administrator@vcac.local, deliveryStatuses={EMAIL_PROVIDER=SENT}, message=null], status = SENT
2014-12-27 17:08:17,326 vcac: [component=”cafe:notification” priority=”INFO” thread=”queue-pool-executer-1″ tenant=””] com.vmware.vcac.notification.service.impl.NotificationDeliveryStatusServiceImpl.updateNotificationDeliveryStatus:188 – notificationDeliveryStatus=NotificationDeliveryStatus [notificationId=2587c094-35d4-4fbd-a033-c812d90a3855, deliveryStatus=INPROGRESS, recipientDeliveryStatuses=[RecipientDeliveryStatus [recipientId=Administrator@vcac.local, deliveryStatuses={EMAIL_PROVIDER=SENT}, message=null]], version=1], size=1, numberOfInProgress=0, numberOfSent=1, numberOfFailed=0, numberOfDisabled=0
2014-12-27 17:08:17,327 vcac: [component=”cafe:notification” priority=”INFO” thread=”queue-pool-executer-1″ tenant=””] com.vmware.vcac.notification.service.impl.NotificationDeliveryStatusServiceImpl.retrieveNotificationDeliveryStatus:73 – Retrieve notification delivery status NotificationDeliveryStatus [notificationId=2587c094-35d4-4fbd-a033-c812d90a3855, deliveryStatus=SENT, recipientDeliveryStatuses=[RecipientDeliveryStatus [recipientId=Administrator@vcac.local, deliveryStatuses={EMAIL_PROVIDER=SENT}, message=null]], version=1]

Capture11

Our email server seems to work just fine.

 

 

Categories: Homelab Tags: