Configuring for more complex email server connections (SMTP)
Who is this article for?
IT Administrators connecting the system to an SMTP server
SMTP server access is required.
The application services and Robot can be configured to connect to a mail server in order to send various notifications and password reset emails to end users.
The supplied configurations are simple, and suitable where the services can make an anonymous connection to an SMTP server.
This article describes config changes allowing more complex connections, e.g. different ports, use of SSL etc.
Changing the application services
Three of the configuration files contain email settings:
- Service\web.config
- FBA\web.config
- WebUI\web.config
As standard, each contains a section called <Pentana.Tng.UI.Web.FBA>that allows a basic anonymous connection to an SMTP server, on port 25.
For more complex connections, you must add the following section the end of the file (just above the </configuration> tag):
<system.net>
<mailSettings>
<smtp from="YourAccount@gmail.com">
<network host="smtp.gmail.com"
port="587"
userName="YourAccount@gmail.com"
password="YourPassword"
enableSsl="true"/>
</smtp>
</mailSettings>
</system.net>The change must be made to Service\web.config, FBA\web.config and WebUI\web.config.
Changing the files will restart the application, and users will be disconnected.
Changing the Robot
The Robot supports four additional settings:
- SMTPUser and SMTPpwd for user authentication
- SMTPport, for specifying an SSL or non-standard port
- SMTPuseSSL to specify use of SSL
These lines are included in the config file.
Using Gmail
The section below describes correct configuration for connecting the application to Gmail.
In recent times we have found that Google may block connection from the application, even when configured correctly. If you get the error "SocketException: No connection could be made because the target machine actively refused it" then configuration may be correct, but the connection is being blocked
You cannot connect to the Gmail SMTP server using your Gmail username and password.
In order to use Gmail, your account must have 2-Step Verification enabled, and you must create an app password.
Port 465 is no longer supported.
When connecting to Gmail, you might see the following errors:
-
IOException - Message: Unable to read data from the transport connection: net_io_connectionclosed.
This occurs if you specify port 465. Change the port number to 587 -
SmtpException - Message: The SMTP server requires a secure connection or the client was not authenticated. The server response was: 5.7.0 Authentication Required.
This occurs if you specify your Gmail account password. Use an app password instead.
Additional considerations
Specifying a consistent 'from' address
You are likely to want to ensure that addresses used are consistent, and must ensure that the mail server is authorised to send for that address. You can find more information on our guide to troubleshooting Robot service not starting with the 5.7.1 error.
Using <mailSettings> in the robot config
If you can add the <system.net><mailSettings> configuration into the Robot config file, the application ignores it. It will use the values specified in the 'add key' lines in preference.
Precedence of email addresses
Different types of email pick their email config from different locations. You can find more information in our article on which email address is used for sending emails.