Example #1
0
        public Email(string server, string login, int port, bool sslCheck, string toAddr, string fromAddr, string password, string bodyMessage,EmailDialog emailDia, string subject)
        {
            dia = emailDia;
            try
            {
                NetworkCredential nw = new NetworkCredential(login, password);
                // Command line argument must be the SMTP host.
                client = new SmtpClient(server);
                client.Credentials = nw;
                client.EnableSsl = (sslCheck == true) ? true : false;
                // Specify the e-mail sender.
                // Create a mailing address that includes a UTF8 character
                // in the display name.

                MailAddress from = new MailAddress(fromAddr, "", System.Text.Encoding.UTF8);
                client.Port = port;
                // Set destinations for the e-mail message.
                MailAddress to = new MailAddress(toAddr);
                // Specify the message content.
                message = new MailMessage(from, to);
                message.Body = bodyMessage;

                message.Subject = subject;
                message.SubjectEncoding = System.Text.Encoding.UTF8;

                // Set the method that is called back when the send operation ends.
                client.SendCompleted += new
                SendCompletedEventHandler(SendCompletedCallback);
                // The userState can be any object that allows your callback
                // method to identify this send operation.
                // For this example, the userToken is a string constant.
                string userState = "Sticky note message";
                client.SendAsync(message, userState);
            }
            catch (Exception e)
            {
                CreateDialog(e.Message);
            }
        }
Example #2
0
        public Email(string server, string login, int port, bool sslCheck, string toAddr, string fromAddr, string password, string bodyMessage, EmailDialog emailDia, string subject)
        {
            dia = emailDia;
            try
            {
                NetworkCredential nw = new NetworkCredential(login, password);
                // Command line argument must be the SMTP host.
                client             = new SmtpClient(server);
                client.Credentials = nw;
                client.EnableSsl   = (sslCheck == true) ? true : false;
                // Specify the e-mail sender.
                // Create a mailing address that includes a UTF8 character
                // in the display name.

                MailAddress from = new MailAddress(fromAddr, "", System.Text.Encoding.UTF8);
                client.Port = port;
                // Set destinations for the e-mail message.
                MailAddress to = new MailAddress(toAddr);
                // Specify the message content.
                message      = new MailMessage(from, to);
                message.Body = bodyMessage;

                message.Subject         = subject;
                message.SubjectEncoding = System.Text.Encoding.UTF8;

                // Set the method that is called back when the send operation ends.
                client.SendCompleted += new
                                        SendCompletedEventHandler(SendCompletedCallback);
                // The userState can be any object that allows your callback
                // method to identify this send operation.
                // For this example, the userToken is a string constant.
                string userState = "Sticky note message";
                client.SendAsync(message, userState);
            }
            catch (Exception e)
            {
                CreateDialog(e.Message);
            }
        }
Example #3
0
 void m5_Click(object sender, RoutedEventArgs e)
 {
     TextRange   tr          = new TextRange(rtb.Document.ContentStart, rtb.Document.ContentEnd);
     EmailDialog emailDialog = new EmailDialog(tr.Text);
 }
Example #4
0
 void m5_Click(object sender, RoutedEventArgs e)
 {
     TextRange tr = new TextRange(rtb.Document.ContentStart, rtb.Document.ContentEnd);
     EmailDialog emailDialog = new EmailDialog(tr.Text);
 }