Email configuration

From ISPWiki
Jump to: navigation, search

Sending notifications

In order to send notifications, BILLmanager can use local or external mail server.

BILLmanager will check a local mail server during setup. If no servers are found, BILLmanager will installExim, Postfix or Sendmail, depending on package manager.

BILLmanager does not perform any additional configuration of a local mail server not to modify configuration of already running mail server (it might be configured manually). Therefore, a server administrator should configure a local MTA.

Setting up the local mail server

By default, the billing panel tries to send notifications through a local mail server.

It calls the sendmail -t command, and passes a messages with all headings.

Setting up the external mail server

In order to connect an external mail server, navigate to Mail gateways -- click "Add" and follow the steps of the New gateway Wizard, consisting of two steps:

  • Step 1. Add a new gateway. Select a gateway. In our example, we'll choose "External mail server".
  • Step 2. Gateway parameters. Enter parameters to connect to the remote SMTP server.


Billmgr-gw-remoten2.png

Mail headings

When sending emails, the mailbox from the provider's configuration for, will be added into from . The gateway mailbox is added into sender.

Procedure

BILLmanager forms an email based on a template, and adds data into the notifytask table.

db EXTINFO Query: 'INSERT INTO notifytask (createdate, filename, forcedonothing, id, modulename, priority) VALUES('2016-06-27', 'var/notify/2016-06-27/cTMzU21yVzBTaW1kT1BqLw==_autoprolongwarning_ntemail_13452.xml', 'off', '2629', 'ntemail', '50’)'

The email is saved in the file in /usr/local/mgr5/var/notify/<date>/<message id>

The utility that views notifytask and sends all emails from the table, starts every minute

/usr/local/mgr5/notify/ntemail --command process

Once the email is sent, the table is cleared, and the file is removed.

Receiving notifications

BILLmanager uses local and external mail servers to receive notifications.

Email identification

When sending notifications to the incoming gateway, the system checks the mailbox, from which the email was sent. If the email is already registered in the billing system as a client's email, emails are associated with that client, and sent to the "Tickets" module to a department specified in the gateway configuration form.

If the email is sent from unknown mailbox, it is forwarded to the "Incoming emails" module, where staff member can sort them manually.

What emails are sent to the billing system, and what are not

The billing system checks all unread emails. BILLmanager will receive the emails if the mailbox specified in the gateway configuration form, is displayed in the 'TO' heading of the incoming email. If the email was sent to the mailbox for which the gateway is not configured, it won't be redirected to the billing system. Empty emails are ignored as well.

For example, in BILLmanager the gateway for incoming emails is configured for support@company.NET

Only emails sent to support@company.net will be forwarded to the billing system. If you configure the mailbox support@company.COM as alias for support@company.net, emails sent to support@company.com won't be received by the billing panel, because the gateway is not configured for that mailbox.

If the email is sent to both recipients - support@company.net and support@company.com, the email will be received by the billing.

If you use POP and select "Do not perform any operations" with incoming email, all incoming emails will be uploaded. If you use IMAP, only unread emails will be uploaded.

Local mail server

To get email from the local mail server, when adding a new gateway, select "External mail server" and configure connection to localhost".

External mail server

In order to connect an external mail server, navigate to Mail gateways -- click "Add" and follow the steps of the New gateway Wizard, consisting of two steps:

  • Step 1. Add a new gateway. Select a gateway. In our example, we'll choose "External mail server".
  • Step 2. Gateway parameters. Enter parameters to connect to the remote (or local) POP3/IMAP server.


Billmgr-gw-remote-2-en.png


Once in a several minutes BILLmanager tries to connect to a POP3/IMAP server to receive unread emails, and mark them as read. However, if you use POP3 server, emails sometimes are marked unread (depending on mail server settings). In this case, when the billing system will receive them again next time. You can select "Delete email from server" in the "When a new email arrives " field.

Logging

You can find the billing log file of the local mail server in

/usr/local/mgr5/var/gwlocalmail.log

In order

gwlocalmail.notify  9

or

gwlocalmail.*  9

into the /usr/local/mgr5/etc/debug.conf file

You can find the billing log file of the external mail server in

/usr/local/mgr5/var/gwremotemail.log


In order to see more information, add the following record

gwremotemail.notify  9

or

gwremotemail.*  9 

into the /usr/local/mgr5/etc/debug.conf file