The Artima Developer Community
Sponsored Link

.NET Buzz Forum
Indigo SMTP/POP3 transports details

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
Christian Weyer

Posts: 616
Nickname: cweyer
Registered: Sep, 2003

Christian Weyer is an independent Microsoft MSDN Regional Director and expert for Web services.
Indigo SMTP/POP3 transports details Posted: Nov 20, 2003 3:19 AM
Reply to this message Reply

This post originated from an RSS feed registered with .NET Buzz by Christian Weyer.
Original Post: Indigo SMTP/POP3 transports details
Feed Title: Christian Weyer: Web Services & .NET
Feed URL: http://www.asp.net/err404.htm?aspxerrorpath=/cweyer/Rss.aspx
Feed Description: Philosophizing about and criticizing the brave new world ...
Latest .NET Buzz Posts
Latest .NET Buzz Posts by Christian Weyer
Latest Posts From Christian Weyer: Web Services & .NET

Advertisement

Once again, I am reporting an interesting posting from the Indigo newsgroup - this time from Microsoft's Haktan Buyukcetin (I edited the text for betting reading, though). Enjoy!

Here is a high-level overview of how the SMTP/POP3 transports work:
 
1.   With the SmtpTransport you (user1 in the example below) send a SOAP message to another user’s (user2) mailbox using user1's relay server.
2.   After the message arrives in user2's mailbox, it will be stored in user2’s mailbox like a regular piece of mail with an attachment (the attachment is a SOAP envelope) until user2’s Pop3Transport polls for this message. The Service in Port2 does not have to be running at that time as long as its mailbox is operational. 
 
Functionally, you can think of the SMTP/POP3 transports like any other type of mail client (e.g., Outlook Express). There is no integration with other client apps.
 
You can share your own mailbox with these transports. These messages will appear in your mail client with subject line "@@SOAP.......".  If your client email program configuration is not set to download mails locally, the Pop3Transport will poll only for these SOAP messages, process them, and delete them from your mailbox periodically.
 
Here is an attached sample. Although port1 sends a message to port2, both ports are configured to send and receive messages:
 

class TestMessageHandler : SyncMessageHandler
{
   public TestMessageHandler() : base()
   {
   }
   public override bool ProcessMessage(Message message)
   {
     Console.WriteLine("ProcessMessage");
     return true;
   }
}

 

Test code:
 
string password1 = "password1"; // for port1 user Mail Server (Exchange) Password
string alias1 = "alias1"; // for port1 user alias
 
string password2 = "password2"; // for port2 user Mail Server (Exchange) Password
string alias2 = "alias2"; // for port2 user alias

string exchangeServer1 = "exchangeServer1"; // mail server's host name
string domain1 = "yourcompanydomain1.com"; 
 
string exchangeServer2 = "exchangeServer2"; // mail server's host name
string domain1 = "yourcompanydomain2.com"; 
 
Uri port1Address = new Uri("soap.mail://" + alias1 + "@" + domain1); // soap.mail://alias1@yourcompanydomain1.com
Uri port2Address = new Uri("soap.mail://" + alias2 + "@" + domain2); // soap.mail://alias2@yourcompanydomain2.com
 
Uri port1PopAddress = new Uri("pop://" + alias1 + ":" + password1 + "@" + exchangeServer1);
Uri port2PopAddress = new Uri("pop://" + alias2 + ":" + password2 + "@" + exchangeServer2);
 
// Sender code starts here
Port port1 = new Port(port1Address);
                 
// for sending messages
// you can set these from configuration as well
SmtpTransport smtpTransport1 = port1.Transports["soap.mail"] as SmtpTransport;
smtpTransport1.RelayServer = exchangeServer1;
smtpTransport1.Sender = alias1 + "@" + domain1;
 
// for receiving messages
// don't need if you don't want to receive any messages back
// you can set these from configuration as well
port1.TransportAddresses.Add(new Pop3TransportAddress(port1PopAddress)); 
port1.ReceiveChannel.Handler = new TestMessageHandler(); //don't need if you don't want to receive any messages back
port1.Open();
 
Message message = new Message(port2Address,"test content");
port1.CreateSendChannel(port2Address).Send(message);
 
Console.WriteLine("Message Sent");
Console.WriteLine("Press Enter to Continue");
Console.ReadLine();
port1.Close();
 
// receiver code starts here.
Port port2 = new Port(port2Address);
// for sending messages,
// don't need if you don't want to send messages back to the port1
// you can set these from configuration as well
SmtpTransport smtpTransport2 = port2.Transports["soap.mail"] as SmtpTransport;
smtpTransport2.RelayServer = exchangeServer2;
smtpTransport2.Sender = alias2 + "@" + domain2;
 
// for receiving messages
// don't need if you don't want to receive any messages back
// you can set these from configuration as well
port2.TransportAddresses.Add(new Pop3TransportAddress(port2PopAddress));
port2.ReceiveChannel.Handler = new TestMessageHandler();
port2.Open();
     
Console.WriteLine("Press Enter to Continue");
Console.ReadLine();
port2.Close();

 

Read: Indigo SMTP/POP3 transports details

Topic: Ninja Gaiden Previous Topic   Next Topic Topic: Yukon Demo: AdventureWorks Contacts

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use