• Main
  • >
  • Blog
  • >
  • Tutorial
  • >
  • Example of Sending Email Notifications from Netping Using Local SMTP Server in OS Windows
Tutorial
8/14/2015

Example of Sending Email Notifications from Netping Using Local SMTP Server in OS Windows

 

Пример отправки Email уведомлений от Netping при помощи локального SMTP Relay

NetPing devices for monitoring server rooms and remote controlling a power supply have got a possibility to send e-mail notifications about triggering sensors and relays, as well as send periodical reports about status of sensors according to previously configured schedule at the page of a web interface. However, the firmware of the module for sending e-mail notifications and reports of several devices is implemented to support the work with mail servers only, which support SMTP protocol, and an authentication method AUTH PLAIN. In addition, a module for sending e-mail notifications and reports cannot support SSL, TLS or other encoding types.

To avoid problems with sending e-mail notifications from devices NetPing through SMTP servers that work without authorization, or support an authentication method AUTH LOGIN and TLS encoding, it is possible to use a local SMTP relay from Microsoft. It is installed in server rooms under Windows OS in several minutes and requires a minimal configuration to start sending e-mail notifications.

As a result of using SMTP relay in server rooms under Windows OS, we have a working functionality for sending e-mail notifications from NetPing devices regardless features of the module sendmail, implemented in firmware of devices.

Requirements

To implement sending e-mail notifications through an SMTP relay from Microsoft, there is a need to have:

Configuring SMTP Relay in Windows OS

In this article, installing and configuring an SMTP relay on Windows Server 2012 R2 OS is described.

On default, Windows OS SMTP relay is not installed in server rooms. Firstly, there is a need to install an SMTP relay to implement sending e-mail notifications. To do this, there is a need to connect to a console of a server with an administrator's rights. Open a window «Server Manager» and choose a menu item «Add roles and features»:

Меню для добавления новой роли или настройки в Windows Server 2012

A window of settings «Add Roles and Features Wizard» will be opened. At the step named «Installation Type» select a checkbox «Role-based or feature-based installation», which configures roles and additional settings at this local server. Then click the button «Next >»:

Выбор режима установки ролей и дополнительных настроек на локальном сервере Windows Server 2012

At the step «Server Selection» select a checkbox «Select a server from the server pool» with an available pool and click the button «Next >»:

Select a server from the server pool Windows Server 2012

At the step «Features» choose «SMTP Server» out of a represented list by checking a corresponding checkbox:

Установка SMTP Server в Windows Server 2012

While checking the checkbox a window with a list of additional components will appear. These componenets must be installed for an SMTP relay to work fully and properly. There is a need to approve the list of additional components and click the button «Add Features»:

Дополнительные компоненты для установки SMTP relay в Windows Server 2012

The last step is to check components selected at the previous steps. If the preparation was completed properly, it is left to click the button «Install» and wait for the installation to complete.

SMTP relay is configured at the console «Internet Information Services (IIS) 6.0 Manager». To run a console, open a window «Server Manager». To do this, choose «Tools» > «Internet Information Services (IIS) 6.0 Manager» in the upper right menu:

Запуск консоли Internet Information Services (IIS) 6.0 Manager в Windows Server 2012

SMTP relay is being configured in properties of a virtual server «SMTP Virtual Server #1» (any number of virtual servers can be created if necessary):

Процесс настройки SMTP relay осуществляется в свойствах виртуального сервера

In properties of SMTP relay at the tab «General», it is recommended to log operation events of a virtual server using a checkbox «Enable logging»:

Включение логов в SMTP relay от Microsoft

A button «Properties...» opens a window with additional settings of a log file, in the same window it is possible to configure the information, which will be displayed in a log file and choose a location to store log files.

In properties of an SMTP relay at the tab «Access», it is possible to configure several parameters: «Relay...» and «Authentication...».

A function «Relay...» configures settings of destination IP addresses, emails will be sent. If no additional restrictions are necessary, there is a need to choose «All except the list below». This will allow to send emails to all addresses.

Настройка IP адресов в SMTP relay, на которые будет разрешена отправка писем

The function «Authentication...» allows to configure authentication to the virtual server:

Настройка аутентификации к данному виртуальному серверу

In the window «Authentication», it is possible to choose using anonymous access to a server or configure a basic authentication with TLS encoding if necessary. To configure anonymous access is as simple as to check a checkbox «Anonymous access». If there is a need to configure a basic authentication, then besides checking a checkbox «Basic authentication» there is a need to add users, to whom it is allowed to send emails. To do this, there is a need to click the button «Add...» at the tab «Security» and add required users. In the example for sending e-mail notifications, an account «smtprelay» is added, which is created at the domain «TST». This account will be indicated in settings of the device NetPing at the page «E-MAIL» of a web interface. Sending email through an account of a system administrator will not necessarily work, hence it is desirable to add another user!

Добавление пользователя для использования базовой аутентификации в SMTP relay от Microsoft

In properties of an SMTP relay at the tab «Delivery», a connection to an external email server is configured for sending e-mail notifications to specified destination addresses. There is a need to configure the next parameters: «Outbound Security...», «Outbound connections...» and «Advanced...».

Настройки SMTP relay для подключения к внешнему почтовому серверу для передачи e-mail сообщений указанным адресатам

A parameter «Outbound Security...» allows setting an authentication method to connect an external SMTP server. Let us suppose there is a need to configure a basic authentication to a connected SMTP through the Internet. To do this, there is a need to check a checkbox «Basic authentication» and indicate a username and a password. A username and a password need to be received from the administrator of the server.

SMTP relay - настройка метода аутентификации для подключения к внешнему SMTP серверу

A parameter «Outbound connections...» allows to set a necessary TCP-port for communication, for example, 2525:

SMTP relay - Настройка TCP-порта в для подключения к внешнему почтовому серверу

A parameter «Advanced...» allows to register a full domain name (address, which is used in MX records) or an IP address of a remote SMTP server:

Настройка полного доменного имени или IP адрес удаленного SMTP сервера

To check a correctness of an entered full domain name, there is a need to start checking by clicking «Check DNS». A successful result is followed by the next notification:

The domain name is valid - SMTP relay

Checking Operability of an SMTP Relay in Windows OS

1. To check an operability of an SMTP relay, there is a need to run a command line («Start» > «Run», enter a name of the executable file of the command line «cmd», click «ОК») and enter a command, which allows to connect to an SMTP server via telnet:

telnet localhost 25

If a server service works correctly, then the next notification will appear in response to a command indicated above (i.e., connecting to an SMTP relay is established):

Подключение к SMTP relay по telnet

2. To check if an SMTP relay sends emails to a third party SMTP server, there is a need to create a text file with contents indicated below:

Файл для проверки отправки e-mail сообщений стороннему SMTP серверу от SMTP relay

Copy the file to the folder via the next path: «C:\inetpub\mailroot\Pickup». If the file from the folder «Pickup» disappears after copying, and a message created before in a text file reaches its destination, then SMTP relay is in a completely working condition. 

Debugging SMTP Relay in Windows OS

If for some reason emails do not reach destination numbers, there is a need to check the next parameters:

1. If TCP-port 25 is opened in a firewall;

2. If the SMTP relay service of a server is launched;

3. If a third party SMTP server receives e-mails;

4. If an IP address of a server is in a spam list;

5. If web.config is properly entered. It must look like the following:

<system.net>
    <mailSettings>
            <smtp deliveryMethod="SpecifiedPickupDirectory"
                        from="указать_e-mail">
                <specifiedPickupDirectory 
                                pickupDirectoryLocation="C:\inetpub\mailroot\Pickup" />
            </smtp>
        </mailSettings>
</system.net>

Configuring a NetPing Device for Sending E-mail Notifications

NetPing devices are configured in the simplest way. To do this, there is a need to connect to a device web interface or go to the page «E-MAIL» and fill in the next corresponding parameters:

where:
SMTP Server Address is a domain name or an IP address of a local SMTP relay in Windows OS.
SMTP Server TCP Port is a TCP port SMTP relay in Windows OS.
Username – is a user's account, which was added when configuring a basic authentication in properties of an SMTP relay (the tab «Security»).
Password – is a password for an account.
From – is an e-mail of a sender.
To – is an e-mail of a recipient.

Therefore, a method for sending e-mail notifications from NetPing devices through an intermediate SMTP relay described above allows maintenance staff to receive e-mail notifications and does not depend on an authentication method of an external SMTP server. 


  • UniPing server solution v3
  • UniPing server solution v3/SMS
  • NetPing 8/PWR-220 v3/SMS
  • NetPing 4/PWR-220 v3/SMS
  • NetPing 2/PWR-220 v2/SMS
  • NetPing 2/PWR-220 v1/SMS
  • NetPing 2/PWR-220 v3/ETH
  • NetPing /PWR-220 v3/ETH

Main tags


All devices
All NetPing power
NetPing SMS
NetPing mini-UPS
NetPing 2/PWR-220 v1/SMS
UniPing server solution v3/SMS
UniPing server solution v3
NetPing /PWR-220 v3/ETH
NetPing IO v2
NetPing 4/PWR-220 v3/SMS
UniPing v3
Uniping server solution
NetPing 8/PWR-220 v3/SMS
NetPing 2/PWR-220 v2/SMS
NetPing 2/PWR-220 v3/ETH
NP-SM4
Temperature sensor T811, 2m
Temperature 1-wire, (THS), 2m
▼ All tags
New devices
Temperature sensor T811, 2m
Temperature sensor for measuring an ambient air temperature indoors from -40°C to +125°C. Avoid water details...

Price: 19 usd

UniPing server solution v3
A device for a remote monitoring of sensors via the Ethernet/Internet network. It allows to receive details...

Price: 180 usd

Humidity sensor WS-2
A relative humidity sensor for measuring relative humidity in % and a built-in temperature sensor.Plastic details...

Price: 42 usd

-+ usd usd
Subtotal usd

Your Order