SimpleMailClient

PRELIMINARY INFORMATION - SUBJECT TO CHANGE

Smartsite 8.0 - ...

As of Smartsite 8.0, there's a brand new mail client implementation: SimpleMailClient. It is used within both the manager and the publication engine and uses the app settings as configured within the smartsite.config configuration file.

As a result, from every location an e-mail needs to be send from code, the same configuration applies (which wasn't the case in previous releases). This includes the SMTP ServerAddress setting, as well as the port number and optionally other related settings.

SimpleMailClient settings

The SimpleMailClient does have the settings listed below, and all of them are set according to the corresponding app setting found within the smartsite.config configuration file.

SmtpServerAddress  The name or IP address of the host used for SMTP transactions.
SmtpServerPort  A number greater than zero that contains the port to be used on the specified host.
SmtpServerUserName  Username to be used to authenticate the sender (optional).
SmtpServerPassword  Password to be used to authenticate the sender (optional). 
SmtpEnableSsl  Specifies whether the (underlying) SmtpClient should use Secure Sockets Layer (SSL) to encrypt the connection. 
DefaultSenderAddress  The default sender address to be used. 
SmtpUseConfigFile  Specifies whether or not the settings within the web.config file should be used instead of the other settings. 

SmtpUseConfigFile

All of these settings don't need further explanation, except this one. When you need even more control and/or specific settings to connect to your SMTP server, you can set the SmtpUseConfigFile setting to true, in which case the mailSettings element within the web.config will be used to configure the (underlying) SmtpClient. All the other settings will be ignored in that case.

Notice that when you use this setting, both the web.config files within the www and the wwwmgr directories must contain a mailSettings element.

Header(s)

The SimpleMailClient implementation also supports adding one or more headers to the MailMessage object which is used internally. When the SMTP server, for example, requires an authorization header for each mail message, this can be achieved by specifying one or more headers within the smartsite.config configuration file. See the example below.

XML CopyCode image Copy Code
<mailsettings>
  <headers>
    <header name="X-OUTBOUND-AUTH" value="authorization header" />
  </headers>
</mailsettings>