Dart.Mail Namespace > Smtp Class : Session Property |
Public Property Session As SmtpSession
Dim instance As Smtp Dim value As SmtpSession instance.Session = value value = instance.Session
public SmtpSession Session {get; set;}
public: __property SmtpSession* get_Session(); public: __property void set_Session( SmtpSession* value );
public: property SmtpSession^ Session { SmtpSession^ get(); void set ( SmtpSession^ value); }
private void getMessages(object sender) { //Configure server and account info imap1.Session.RemoteEndPoint = new Dart.Mail.IPEndPoint(myServer, Imap.GetDefaultPort(imap1.Session)); imap1.Session.Username = myUsername; imap1.Session.Password = myPassword; //Connect and log into the account imap1.Connect(); imap1.Authenticate(); //Open the mailbox containing the messages to get imap1.SelectedMailbox = imap1.Mailboxes["INBOX"]; //Specify folder to store messages string messageFolder = Application.StartupPath + "\\messages"; //Download all messages in the account and save them to disk foreach (ImapMessage imapMessage in imap1.SelectedMailbox.ToArray()) { imapMessage.Get(); imapMessage.Message.Save(messageFolder + "\\" + imapMessage.Uid + ".eml"); } //Gracefully logout of the session imap1.Close(); } private void imap1_Progress(object sender, ImapProgressEventArgs e) { //Update progress bar as message is sent progressBar1.Value = (e.Final) ? 0 : (int)((e.Position * 100) / e.Length); }
Private Sub getMessages(ByVal sender As Object) 'Configure server and account info imap1.Session.RemoteEndPoint = New Dart.Mail.IPEndPoint(myServer, Imap.GetDefaultPort(imap1.Session)) imap1.Session.Username = myUsername imap1.Session.Password = myPassword 'Connect and log into the account imap1.Connect() imap1.Authenticate() 'Open the mailbox containing the messages to get imap1.SelectedMailbox = imap1.Mailboxes("INBOX") 'Specify folder to store messages Dim messageFolder As String = Application.StartupPath & "\messages" 'Download all messages in the account and save them to disk For Each imapMessage As ImapMessage In imap1.SelectedMailbox.ToArray() imapMessage.Get() imapMessage.Message.Save(messageFolder & "\" & imapMessage.Uid & ".eml") Next imapMessage 'Gracefully logout of the session imap1.Close() End Sub Private Sub imap1_Progress(ByVal sender As Object, ByVal e As ImapProgressEventArgs) Handles imap1.Progress 'Update progress bar as message is sent progressBar1.Value = If(e.Final, 0, CInt((e.Position * 100) \ e.Length)) End Sub