24.3  Email (Not supported by WinCE)

SMTP (Simple Mail Transport Protocol) is how email is sent. Troubleshooting SMTP is difficult because of security concerns about Spam.  Most email servers limit who can send email in order to prevent spam or a so-called "Open Relay".

 

A quick overview of the default method to send email in Advantech WebAccess/SCADA is:

 

a. The Advantech WebAccess/SCADA SCADA Node software act as an SMTP client.  

b. The Project Node is the first SMTP Server (also called Host) contacted by the SMTP client. The Project Node needs to have IIS with the SMTP Service Installed.  

If you are sending email locally on your domain only, then these two steps are probably all you need to do. The domain is the @companyname.com part if the email address. For example A computer that is part of the Advantech.com domain can send email to any email server that is in the Advantech.com domain without contacting a smart server.

c. If you are sending email outside of your domain, this is called "Relay". The SCADA Node address, as specified in node properties,  must be added to the list of addresses that can "Relay" in the SMTP Service on the Project Node.

d. The SMTP Service on the Project Node must be able to relay to at least one SMART HOST on the internet. The default is to configure a Smart Host in the SMTP Service on the Project Node and to use the Outbound Security of the SMTP Service to specify a user name and password to connect to the Smart Host.  

 

Here are my steps to troubleshooting email assuming the default method above:

 

Step 1 - Examine the bwmail.log

 

Advantech WebAccess/SCADA keeps a log also called BWMAIL.LOG.  It is on the SCADA node at drive:\WebAccess\Node\Projectname_Nodename\bwmail.log

 

Typically it is:

C:\WebAccess\Node\Projectname_Nodename\bwmail.log

 

This is a text file that can be opened by notepad.  It only lists errors.

Bwmail.log is empty or no recent errors

If it is empty, then there was no error in sending the email to the Outbound SMTP Server. (I.e. the Advantech WebAccess/SCADA SMTP Client had no problems connecting with the first Email Server, which is usually the Project Node).  If there are not errors here, you need to go to the Outbound SMTP Server or Host. To determine address is used as the Outbound SMTP Server or Host, see Step 2 below

Unable to relay

If you get the unable to relay message in bwmail

 

Time:10/13/2006 15:59:32

Subject:Advantech WebAccess/SCADA sends emails to pagers, managers and others.

From:Advantech WebAccess/SCADA@Advantech.com

To:carter@Advantech.com {}

Cc:tim@Advantech.com

Bcc:{}

Host:67.94.27.175

Port:25

Status:ERROR: bad response `550 5.7.1 Unable to relay for carter@Advantech.com ', wanted: `25[01]'

1) You need to see if the SCADA Node is authorized to relay on the Outbound SMTP Server or Host.  To determine what is used as the Outbound SMTP Server or Host, see Step 2 below. Note that all the addresses are in the same domain in the above error (Advantech.com).

2) Verify the SMART HOST and Outbound Security's user name and password are correct.

Step 2 - OutBound SMTP Server or Host

 

The way Advantech WebAccess/SCADA uses email for alarms and reports are almost identical. The first SMTP Host contacted by the SCADA Node is specified in OUTBOUND SMTP SERVER in SCADA  Node Properties. See OUTBOUND SMTP SERVER in SCADA node properties.  It is recommend that you use the Project Node's address as the OUTBOUND SMTP SERVER, unless you have other reasons and know that an SMTP client on the SCADA node can connect directly to whatever OUTBOUND SMTP server you are using (i.e. without a password).  

 

If you are debugging Email reports or Email Alarms, go to the OUTBOUND SMTP SERVER listed in SCADA Node Properties and examine the SMTP SERVICE configuration.

 

Scripts and Keymacros differ from alarms and reports in that the default SMTP host is always the Project Node, unless specified in the MAIL HOST command is used.

 

If you are debugging Email reports or Email Alarms, go to the OUTBOUND SMTP SERVER listed in MAIL HOST of your script or keymacro, otherwise, go to the Project Node  and examine the SMTP SERVICE configuration.

 

Step 3 - OUTBOUND SMTP SERVER - SMTP Service

 

 

If you are following the default recommendations, this should be the Project Node.

 

The SMTP Service configuration in Windows 2000 Pro and Server, XP Professional or Server 2003 can be opened using

1.      Start-> Settings-> Control Panel-> Administrative Tools

2.      Select Internet Service Manager 

3.      Select the name of the computer to expand the tree

4.      Right Click on SMTP Virtual Server

5.      Select Properties

Relay

From Properties,

6. Select the Access tab

7. Select the  Relay Button

The SCADA Node's address should be listed as enabled to Relay.  It must be listed in the subnet format similar to that Listed in  or Host. For example, if the Outbound host is contacted using a public IP Address (e.g. 67.94.27.175), then the SCADA node should be listed using it's public address.  If the SMTP Service is contacted using a private address (e.g. 10.0.0.175) then the SCADA node should be listed using it's private IP address.  If the loopback service is used (127.0.0.1) then 127.0.0.1 should be listed.

Use your IP Addresses, not the ones listed this example.

If you allow Anonymous Authentication, Do not select "Allow all computers which successfully authenticate to relay".  This will make your computer an Open Relay and you will be hacked and used to send SPAM. DO NOT SELECT  "Allow all computers which successfully authenticate to relay".

Select OK

Authenticate

You need some method to authenticate (i.e. lo gon). The defaults should work: Antonymous and Integrated Windows Authentication.

From Properties

8. Select the Authentication button

Select OK

Delivery - Outbound Security

For a thorough discussion see 22.3.1 Smart Host

9.      Select Properties

10.      Select the Delivery Tab

11.      Select the Advanced button

12.      Under Smart Host, type the address of your SMTP mail server.

This can be an IP Address or the URL (e.g. mail.company.com). You will need to get the exact name from your System Administrator.  This is usually the same server name used to setup an ordinary email account.  You can use mail.Advantech.com for testing, but you will need to contact support@Advantech.com for the password of an account to log in with.

Enable "Attempt direct delivery before sending to smart host" if you are sending mail to other computers on the same LAN or intranet.

9.       Select OK to close the Advanced Delivery dialog box.

10.  Select the Outbound Security Button.

 

11.  Select Basic authentication.

12. Enter the Username for the email account.  For example: bwuser@Advantech.com

13. The Enter the Password. For example: bwuser4592.  If you are using mail.Advantech.com, you will need to contact support@Advantech.com for the password.  The password for mail.Advantech.com changes periodically to reduce it's use by spammers

14. Select OK.

15. Select OK a second time to close the default SMTP Server applet.

 

If the above doesn't work, then try examining the SMTP Logs. (Step 4)

 

Step 4 - SMTP Logs on OUTBOUND SMTP SERVER or Host

 

If you are using the default recommendations, the OUTBOUND SMTP SERVER or Host is the Project Node.

 

Verify Logging is enabled and the path to the logs.

 

On the OUTBOUND SMTP Server (typically the project node),

1.      Start-> Settings-> Control Panel-> Administrative Tools

2.      Select Internet Service Manager 

3.      Select the name of the computer to expand the tree

4.      Right Click on SMTP Virtual Server

5.      Select Properties

6. Select the General Tab

7. Verify Enable Logging is checked.

8. Select Properties button,

9. Select General Properties Tab.

10.  Verify the path

11. Select Extended Properties tab, and make sure most fields are checked for logging especially protocol status.

Select OK

View SMTP Logs on OUTBOUND SMTP SERVER

If you are using the default recommendation,  the OUTBOUND SMTP Server is the  Project Node. Look at the SMTP Logs on whatever  OUTBOUND SMTP Server you are trying to use.

The logs, by default are at C:\WINDOWS\system32\Logfiles\SMTPSVC1

However, you should have verified the logs are enabled and their location in step 6 and step 9 above.

If you see the IP address of the SCADA node connecting with all code 250 and DAT or BDAT with code 250, and you see an OUTBOUND connection, then it is successfully receiving email from the SCADA node and forwarding it to the Smart Host. The problem is not here, you need to examine similar logs on your smart host.

If you do not see an OUTBOUND connection to the destination, then this SMTP server is not forwarding the email.  Maybe the Outbound Security on this SMTP server uses the wrong SMART HOST, User name or password.

If you see 550 or 500 or 554 when the SCADA node tries to connect, then the SMTP server is rejecting the SCADA node due to security. Possible causes are:
SCADA Node not listed in list of IP Addresses allowed to relay.
SCADA node Address is wrong subnet or format in the list authorized to relay
 

Example of successfully message in SMTP Logs:

1) Note the pattern EHLO, MAIL, RCPT, DATA, QUIT all with a 250 code.

2) If sending outside your domain, there should be an Outbound connection with a similar pattern EHLO, MAIL, RCPT, DATA ( or BDAT), QUIT all with a 250 or other 200 code

 

00:58:26 67.94.27.177 tuna TUNA 67.94.27.177 EHLO - +tuna 250 0 196 9 0 - - -

00:58:26 67.94.27.177 tuna TUNA 67.94.27.177 MAIL - +FROM:<Advantech WebAccess/SCADA@Advantech.com> 250 0 47 34 0 - - -

00:58:26 67.94.27.177 tuna TUNA 67.94.27.177 RCPT - +TO:<user1@sbc.net> 250 0 40 37 0 - - -

00:58:26 67.94.27.177 tuna TUNA 67.94.27.177 DATA - <TUNAhKkvAUeMo6kKqtD00000018@tuna.Advantech.com> 250 0 130 758 110 - - -

00:58:26 67.94.27.177 tuna TUNA 67.94.27.177 QUIT - tuna 0 125 130 758 110 - - -

00:58:26 - OutboundConnectionResponse TUNA - - - 220+mail.Advantech.com+Microsoft+ESMTP+MAIL+Service,+Version:+6.0.3790.1830+ready+at++Mon,+16+Oct+2006+17:57:56+-0700+ 0 0 117 0 0 - - -

00:58:26 mail.Advantech.com OutboundConnectionCommand TUNA - EHLO - tuna.Advantech.com 0 0 4 0 16 - - -

00:58:26 mail.Advantech.com OutboundConnectionResponse TUNA - - - 250-mail.Advantech.com+Hello+[67.94.27.177] 0 0 42 0 16 - - -

00:58:26 mail.Advantech.com OutboundConnectionCommand TUNA - AUTH - - 0 0 4 0 16 - - -

00:58:26 mail.Advantech.com OutboundConnectionResponse TUNA - - - 334+UGFzc3dvcmQ6 0 0 16 0 16 - - -

00:58:26 mail.Advantech.com OutboundConnectionResponse TUNA - - - 235+2.7.0+Authentication+successful. 0 0 36 0 235 - - -

00:58:26 mail.Advantech.com OutboundConnectionCommand TUNA - MAIL - FROM:<Advantech WebAccess/SCADA@Advantech.com> 0 0 4 0 16 - - -

00:58:26 mail.Advantech.com OutboundConnectionResponse TUNA - - - 250+2.1.0+Advantech WebAccess/SCADA@Advantech.com....Sender+OK 0 0 45 0 235 - - -

00:58:26 mail.Advantech.com OutboundConnectionCommand TUNA - RCPT - TO:<user1@sbc.net> 0 0 4 0 235 - - -

00:58:26 mail.Advantech.com OutboundConnectionResponse TUNA - - - 250+2.1.5+user1@sbc.net+ 0 0 31 0 235 - - -

00:58:26 mail.Advantech.com OutboundConnectionCommand TUNA - BDAT - 1070+LAST 0 0 4 0 235 - - -

00:58:26 mail.Advantech.com OutboundConnectionResponse TUNA - - - 250+2.1.0+Advantech WebAccess/SCADA@Advantech.com....Sender+OK 0 0 45 0 16 - - -

00:58:26 mail.Advantech.com OutboundConnectionCommand TUNA - QUIT - - 0 0 4 0 485 - - -

00:58:26 mail.Advantech.com OutboundConnectionResponse TUNA - - - 221+2.0.0+mail.Advantech.com+Service+closing+transmission+channel 0 0 64 0 485 - -