WindowsMobileMailBinding Class
Represents the mail binding for Windows Mobile devices.
Assembly: Microsoft.ServiceModel.Channels.Mail.WindowsMobile (in Microsoft.ServiceModel.Channels.Mail.WindowsMobile.dll)
WindowsMobileMailBinding is a sealed class that represents the mail binding for Windows Mobile devices. The mail binding enables you to synchronize messages with a Microsoft Exchange server.
The base class, MailBindingBase, contains most of the functionality used by this class.
The WindowsMobileMailBinding class includes a collection of binding elements such as an encoding element and a transport binding element. The predefined encoding element for this class is TextMessageEncodingBindingElement, and the predefined transport binding element is WindowsMobileMailTransportBindingElement.
The following example shows how to use the WindowsMobileMailBinding class in the context of sending and receiving messages.
The custom serializer is not specific to the Exchange Server mail transport and is not included in this example.
Class Program Private Shared ChannelName As String = "Channel1" Private Shared DestinationEmailAddress As String = "someone@fabrikam.com" Private Shared serializer As New CFMessagingSerializer(GetType(String)) Shared Sub Main(ByVal args() As String) ' For desktop applications, use ExchangeWebServiceMailBinding ' instead of WindowsMobileMailBinding. Dim binding As WindowsMobileMailBinding Dim factory As IChannelFactory(Of IOutputChannel) Dim listener As IChannelListener(Of IInputChannel) Dim output As IOutputChannel Dim input As IInputChannel Dim bpc As BindingParameterCollection Dim message As Message Dim str As String ' For desktop applications, use ExchangeWebServiceMailBinding. binding = New WindowsMobileMailBinding() bpc = New BindingParameterCollection() factory = binding.BuildChannelFactory(Of IOutputChannel)(bpc) factory.Open() output = factory.CreateChannel(New EndpointAddress(MailUriHelper.Create(ChannelName, DestinationEmailAddress))) output.Open() message = System.ServiceModel.Channels.Message.CreateMessage(MessageVersion.Default, "urn:Test", "Hello, World!", serializer) output.Send(message) output.Close() factory.Close() listener = binding.BuildChannelListener(Of IInputChannel)(MailUriHelper.CreateUri(ChannelName, "")) listener.Open() input = listener.AcceptChannel() input.Open() message = input.Receive() str = message.GetBody(Of String)(serializer) MessageBox.Show(str, "Received message") input.Close() listener.Close() binding.Close() End Sub End Class
System.ServiceModel.Channels.Binding
Microsoft.ServiceModel.Channels.Mail.MailBindingBase
Microsoft.ServiceModel.Channels.Mail.WindowsMobile.WindowsMobileMailBinding
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.