Defining an SMTP Delivery Channel
An SMTP delivery channel defines an SMTP server endpoint for delivering notifications using the SMTP delivery protocol. If you use the built-in SMTP delivery protocol in an application hosted by the instance, you must define at least one SMTP delivery channel.
Note
Because of the SMTP implementation used by the Microsoft .NET Framework, you can define only one SMTP delivery channel per instance. If you define two SMTP delivery channels, notifications might go to the wrong SMTP servers.
Note
To use the local Internet Information Services (IIS) SMTP service, make sure to specify a value for the SmtpServer argument. Otherwise, the account that the NS$instanceName service runs under must be a member of the local Administrators group.
SMTP Delivery Channel Properties
When you define a delivery channel for the SMTP delivery protocol, you must use specific values in the ProtocolName and Arguments elements. The following list describes the elements and values required by the SMTP delivery protocol:
- The delivery channel name must be unique within the Notification Services instance and cannot contain the following characters: open bracket ([), close bracket (]), quotation mark ("), single quote ('), backslash (\), and forward slash (/).
- The protocol name must be SMTP.
- The SMTP delivery protocol uses two arguments:
- Specify the SMTP server for the delivery channel. The argument name must be SmtpServer. The value must be the name of an SMTP server or a forwarding server, such as a smart host. If you use a forwarding server, you can avoid local e-mail queuing.
- Specify the body encoding required by the SMTP server. The argument name must be BodyEncoding. The value must be a valid encoding format. All encoding formats returned by the GetEncoding method of the Encoding class in the Microsoft .NET Framework are valid (
us-ascii
,utf-7
,utf-8
,utf-16
, andunicodeFFFE
).
Unicode data typically uses a value ofutf-8
.
Note
You cannot specify connection information (such as name and password) for the SMTP server as part of the delivery channel configuration. The operating system establishes connections to the SMTP server using the service account.
Examples
The following examples show how to define SMTP delivery channels in instance configuration files (ICFs).
SMTP Server
The following example shows how to define a delivery channel for the built-in SMTP delivery protocol. Because the SMTP delivery protocol is built-in, it does not need a corresponding item in the Protocols element of the ICF.
<DeliveryChannels>
<DeliveryChannel>
<DeliveryChannelName>SMTPServer01</DeliveryChannelName>
<ProtocolName>SMTP</ProtocolName>
<Arguments>
<Argument>
<Name>SmtpServer</Name>
<Value>MailServer01</Value>
</Argument>
<Argument>
<Name>BodyEncoding</Name>
<Value>utf-16</Value>
</Argument>
</Arguments>
</DeliveryChannel>
</DeliveryChannels>
Using Smart Host to Relay Messages
The following example shows how use the local IIS SMTP service with the smart host option to relay messages. First, configure the local IIS SMTP service to relay messages, and then configure your SMTP delivery channel as follows.
<DeliveryChannel>
<DeliveryChannelName>EmailChannel</DeliveryChannelName>
<ProtocolName>SMTP</ProtocolName>
</DeliveryChannel>
For more information about configuring the IIS SMTP service, see Using SMTP for Outgoing Messages in the Microsoft MSDN Library.
See Also
Concepts
SMTP Delivery Protocol
Defining Delivery Channels
Other Resources
Instance Configuration File Templates
Configuring Instances of Notification Services