MailUriHelper.Create Method (String, String)
[This documentation is for preview only, and is subject to change in later releases. Blank topics are included as placeholders.]
Creates a mail Uniform Resource Identifier (URI) based on a specified channel and a single e-mail address.
Namespace: Microsoft.ServiceModel.Channels.Mail
Assembly: Microsoft.ServiceModel.Channels.Mail (in Microsoft.ServiceModel.Channels.Mail.dll)
Syntax
'Declaration
Public Shared Function Create ( _
channelName As String, _
emailAddress As String _
) As String
'Usage
Dim channelName As String
Dim emailAddress As String
Dim returnValue As String
returnValue = MailUriHelper.Create(channelName, _
emailAddress)
public static string Create(
string channelName,
string emailAddress
)
public:
static String^ Create(
String^ channelName,
String^ emailAddress
)
static member Create :
channelName:string *
emailAddress:string -> string
Parameters
- channelName
Type: System.String
The channel name to use in the mail URI. Do not use the following characters in the channel name: number sign (#), equal sign (=), semicolon (;), or space (" ").
- emailAddress
Type: System.String
The e-mail address to use in the mail URI. Display names are not supported in e-mail addresses. An example of a valid e-mail address is "someone@example.com".
Return Value
Type: System.String
The mail URI that is created.
Exceptions
Exception | Condition |
---|---|
ArgumentException | The channel name or e-mail address is formatted incorrectly or contains invalid characters. |
Remarks
This method creates a mail URI in the following format:
net.mail://<channel-name>#<e-mail-address>
The e-mail address is used only by the output channel.
Examples
The following example shows how to use the Create(String,String) method overload. The example uses the MailUriHelper class to pass a Uri object as a parameter in a call to the CreateChannel method.
bpc = New BindingParameterCollection()
factory = binding.BuildChannelFactory(Of IOutputChannel)(bpc)
listener = binding.BuildChannelListener(Of IInputChannel)(MailUriHelper.CreateUri(ChannelName, ""))
factory.Open()
output = factory.CreateChannel(New EndpointAddress(MailUriHelper.Create(ChannelName, DestinationEmailAddress)))
bpc = new BindingParameterCollection();
factory = binding.BuildChannelFactory<IOutputChannel>(bpc);
listener = binding.BuildChannelListener<IInputChannel>(MailUriHelper.CreateUri(ChannelName, ""), bpc);
factory.Open();
output = factory.CreateChannel(new EndpointAddress(MailUriHelper.Create(ChannelName, DestinationEmailAddress)));
.NET Framework Security
- Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see Using Libraries from Partially Trusted Code.
Platforms
Windows CE, Windows Mobile for Smartphone, Windows Mobile for Pocket PC
The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.
Version Information
.NET Compact Framework
Supported in: 3.5