Using API to send emails with HmailServer

Visits: 2037

https://www.hmailserver.com/documentation/latest/?page=com_objects

COM API

Overview

The hMailServer COM API lets you write your own scripts and applications that integrate with hMailServer. Almost all objects in hMailServer are accessible using the COM library. As an example, both hMailServer Administrator and the PHP WebAdmin is entirely based upon the COM library. Besides writing application like theese two, you can write scripts that are automatically run when certain events take place. For example, you can write a script that filters messages before they are delivered to the recipients. 

The Best way to have a completely secure server is to install our simple to install EC2 including Roundcube WebMail. You can get started with an Email Cloud Server that is wonderful combination of MS Windows Server  and Open Source Software. It is available through AWS Marketplace as Hmailserver on Windows Server with Roundcube Webmail so that you can check email anywhere and from any device.

Also Check it out AWS Marketplace: Mail Server on Linux Postfix using MySQL for tons of users (amazon.com)

The Application object is the root object in hMailServers COM model. Using this object, you can access all hMailServer objects and settings. Before accessing any of the properties and methods on the Application object, you must call Application.Authenticate with valid credentials.

The hMailServer API behaves as most other COM APIs, but there are some special behavior which relates to exception handling and permissions.

It is possible to create triggers in hMailServer. Triggers are script which are executed when certain actions occur. Triggers are created by adding the script to the EventHandlers-file in the hMailServer Events folder.

Basic steps

These are the basic steps to perform when you want to access the hMailServer COM API.

  1. Create an instance of the hMailServer Application object. How to do this depends on what programming language you use. In VBScript, you call CreateObject(“hMailServer.Application”).
  2. Authenticate. Before you can call any other methods in the API, you need to authenticate. This is done using the Authenticate() method on the Application object. This is required to prevent unauthorized users to access your hMailServer installation.
  3. Call the methods and use the properties you need.

Change log

For a list of changes in the COM API, see the COM API Changelog

.NET Class

The complete COM API is available as a .NET class in the hMailserver bin directory …\hmailserver\bin\Interop.hMailServer.dll

Reference

Examples

Please see the COM API examples page

How to get reverse DNS for your EC2 instance as well as to raise email sending limit. Amazon Web Services

Visits: 1181

Request to Remove Email Sending Limitations In order to maintain the quality of Amazon EC2 addresses for sending email, we enforce default limits on the amount of email that can be sent from EC2 accounts. If you wish to send larger amounts of email from EC2, you can apply to have these limits removed from your account by filling out this form.

Source: Reverse DNS and Email limits on EC2 – Amazon Web Services

HmailServer with SES

Visits: 1439

HmailServer is mostly for receiving email to @yourdomain . SES is for sending email.

Over the last year or so SES added the ability to receive emails but this is very complicated and confusing which is why I install Hmailserver to receive the email.Beware: In the SES panel there are DNS settings that AWS give you to set your DNS to use SES to receive email. This doesn’t work with Hmailserver. In Order to receive email@Yourdomain You need to point the DNS to your HmailServer not to SES.

We hope that someday Our Hmail Servers will be rejuvinated, but in the meantime install this  Complete Email Server with Webmail

For Instructions to use MS Outlook to send and receive email with your new Floating Cloud HmailServer see: http://charmingcloud.net/use-ms-outlook-hmailserver/ 

http://charmingcloud.net/use-ms-outlook-hmailserver/

We have several servers availble in the AWS Marketplace with Hmail Server pre-configured with MySql

The Best way to have a completely secure Postfix server is to install our simple to install EC2 including Roundcube WebMail. Check it out AWS Marketplace: Mail Server on Linux Postfix using MySQL for tons of users (amazon.com)

Amazon allows you to send a limited amount of email through EC2, so you can also send a little through HmailServer. You need to request from Amazon if you would like to use Charming HmailServer for sending email. They will also arrange reverse DNS lookup for this purpose.  Check here:  https://aws.amazon.com/forms/ec2-email-limit-rdns-request?catalog=true&isauthcode=true

The  main idea behind  HmailServer is to receive email for your domain.

  • You must have fixed Ip Address like an elastic IP  in order  for your HmailServer EC2 instance. https://eu-west-1.console.aws.amazon.com/ec2/v2/home?region=eu-west-1#Addresses:sort=PublicIp (adjust the link to use your region)
  • In order to set up your HmailServer to receive email you must set up the DNS with an A record for your domain that uses the Ec2 IP Address.
  • You also need an MX record that points to this A record.
  • You can verify and test the HmailServer in the bottom of the left manager panel you will find troubleshooting that will be kind enough to check whether your server is set up to receive and even send emails.

You can setup your gmail account to forward to your new domain , once that is receiving email.

In order to setup your Floating Cloud Server to receive email you need to first setup an MX record that points to the domain on this server.

Click Settings – Protocols – SMTP  –  then click the Delivery of Email Tab  under  fill in your Domain Name in Local Host name that you are sending from, then press Save.  Although HMAILServer requires this,  you might not be able to send any emails as these are often blocked by Amazon. Instead you should set your email cllient, like Outlook, Thunderbird, etc to use Amazon SES.

Under Hmailserver Administrator add Email Addresses

UNder Domain – Your Domain Name – Click Accounts,

Press Add, on the right side

Fill in, at least the email address, Password and Maximum size for Mailbox.

To check email use full email address, though sometimes just the username is enough.

HmailServer  Adminstrator password has been left blank you certainly add a secure password  instead of blank

  1. Start hMailServer Administrator and log on.
  2. Go to Settings -> Advanced
  3. Enter the new Administration password and save the changes.

Check https://www.hmailserver.com/ for all of the documentation for Hmailserver

Hmailserver is very powerful , these instruction just get you going.

You can setup your email client like Outlook or Thunderbird. Check https://www.hmailserver.com/ for instructions

I suggest NOT using this server as SMTP. It isn’t setup to relay. We have found AWS SES service to be the best, To use SES in your client
Use port 587 or 465
IAM and SES will assign you an SMTP username and password
For security try starttls

Send an email to support@float.i.ng if you have an issue setting up SES, it can be confusing. We won’t be able to assist in making your Floating Cloud Server do SMTP in a manner that the email won’t be blocked by spam filters.

Amazon often blocks sending mail from EC2 servers, you should request that AWS permit you to use SES, then setup your SMTP mail client to use SES. To get started with SES go to SES in your AWS panel.

I suggest NOT using this server as SMTP. It isn’t setup to relay. We have found AWS SES service to be the best, To use SES in your client
Use port 587 or 465
IAM and SES will assign you an SMTP username and password
For security try starttls

Send an email to support@float.i.ng if you have an issue setting up SES, it can be confusing. We won’t be able to assist in making your Floating Cloud Server do SMTP in a manner that the email won’t be blocked by spam filters.

Amazon often blocks sending mail from EC2 servers, you should request that AWS permit you to use SES, then setup your SMTP mail client to use SES. To get started with SES go to SES in your AWS panel.

The Floating Cloud Server has several features that have been added especially for our clients. These include

We have installed several
init scripts called that set the passwords to your Instance ID

Setup DNS – Route 53 with A and MX records for your domain

After you set you set up the DNS

login  To Windows and Run from the Start Menu HmailServer administrator

  • This is my advice for using SES along side your new Floating Clouf Full email server.

HmailServer does not currently have a catchall relay smtp function like Postfix or Sendmail in Linux.

You can set up Roundcube to send ALL messages via SES with the following settings.

Edit C:\inetpub\wwwroot\webmail\config\config.inc.php

edit the line $config[‘smtp_server’]  to the following. Remember Semi-colons

If you are NOT using US-EAST Nvirginia than change the server name to whatever SES settings tells you to use. Contact support@float.i.ngfor any assistance.

$config[‘smtp_server’] = ‘tls://email-smtp.us-east-1.amazonaws.com:587’;

Just below add these lines, change the CAPS for your

$config[‘smtp_user’] = ‘YOUR-SES-USERNAME-RANDOM-CHARS’;
$config[‘smtp_pass’] = ‘YOUR-SES-PASSWORD_THAT-is REALLY-LONG’;

  • You can setup each Outlook with SES SMTP settings

The following deals with a small issue using SES with Outlook http://charmingwebdesign.com/how-to-set-pop3-and-smtp-server-port-addresses-for-win-10-mail-app-tls-aws-ses/

  • You should additionally ask AWS to allow your Instance to send emails. As it is now it is limited to just a few messages an hour or less. They won’t tell you. However you can ask them for both reverse DNS and allowing you to send emails in the same form:
https://aws.amazon.com/forms/ec2-email-limit-rdns-request?catalog=true&isauthcode=true

See also

http://charmingwebdesign.com/how-to-get-reverse-dns-for-your-ec2-instance-as-well-as-to-raise-email-sensing-limit-amazon-web-services/

I checked out backup the db,

I didn’t try it but found this:

However, you might be interested in periodic snapshots of the volume, snapshots are incremental, so you don’t pay for the full 70 GB every time.

https://www.hmailserver.com/forum/viewtopic.php?t=30217

Set WordPress all of your pages to private so that you can un-publish them

Visits: 531

Just set them to private in the database, using the following query:

UPDATE `wp_posts` SET `post_status` = 'private';

This would set all posts to private, I guess you won’t really use that query.

Instead, to only set articles to ‘private’ use:

UPDATE `wp_posts` SET `post_status` = 'private' WHERE `post_type` = 'post';

and to only disable pages, use:

UPDATE `wp_posts` SET `post_status` = 'private' WHERE `post_type` = 'page';

Post-revisions have the status ‘inherit’ and thus get the right inherited from the parent page or article.

https://stackoverflow.com/questions/16209821/can-you-make-all-wordpress-pages-private-simultaneously-without-a-plugin

Upgrade Php 5.6 for Windows WAMP server

Visits: 2285

Within your Windows Server, Download the latest version of Php 5.6 of

VC11 x86 Non Thread Safe 5.6

from

https://windows.php.net/download/

Download the Zip File. the open it, It should be in your Downloads Folder. and select extract all, then extract them to a new sub-directory in downloads

Copy the new sub-directory to C:\Program Files (x86)\PHP

You can get started with an Email Cloud Server that is wonderful combination of MS Windows Server  and Open Source Software. It is available through AWS Marketplace as Hmailserver on Windows Server with Roundcube Webmail so that you can check email anywhere and from any device.

Select continue if asked

Turn off the HmailServer, IIS (W3SVC) MySql,  and and any other services that use Php. If you dont follow the order , then you’ll get an error like in the picture.

You wont be allowed to change the name of the old folder unless you stop the services that are using it or each other.

After you stopped the services, change the name (dont delete it for a few days) of the old Php5.6 folder to php5.6.old. Then  change the name of the new folder that you copied from the extracted zip file within the PHP dir. to php5.6  – You need to give it the same name as the old folder since IIS uses the files by following the path given it iin IIS FastCGI settings.

Now you need to copy the php.ini file from the old directory to the new.

Start the services that you stopped before.

Test your website, Roundcube and WordPress use both Php and Mysql, so if those don’t work then something is wrong.

If you did something wrong you’ll get a 500 error or White Screen of Death.