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
            {
                var nw = new NetworkCredential(login, password);
                // Command line argument must be the SMTP host.
                _client = new SmtpClient(server)
                {
                    Credentials = nw,
                    EnableSsl = sslCheck ? true : false
                };
                // Specify the e-mail sender.
                // Create a mailing address that includes a UTF8 character
                // in the display name.

                var from = new MailAddress(fromAddr, "", Encoding.UTF8);
                _client.Port = port;
                // Set destinations for the e-mail message.
                var to = new MailAddress(toAddr);
                // Specify the message content.
                _message = new MailMessage(from, to)
                {
                    Body = bodyMessage,
                    Subject = subject,
                    SubjectEncoding = Encoding.UTF8
                };


                // Set the method that is called back when the send operation ends.
                _client.SendCompleted += 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.
                var 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
            {
                var nw = new NetworkCredential(login, password);
                // Command line argument must be the SMTP host.
                _client = new SmtpClient(server)
                {
                    Credentials = nw,
                    EnableSsl   = sslCheck ? true : false
                };
                // Specify the e-mail sender.
                // Create a mailing address that includes a UTF8 character
                // in the display name.

                var from = new MailAddress(fromAddr, "", Encoding.UTF8);
                _client.Port = port;
                // Set destinations for the e-mail message.
                var to = new MailAddress(toAddr);
                // Specify the message content.
                _message = new MailMessage(from, to)
                {
                    Body            = bodyMessage,
                    Subject         = subject,
                    SubjectEncoding = Encoding.UTF8
                };


                // Set the method that is called back when the send operation ends.
                _client.SendCompleted += 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.
                var userState = "Sticky note message";
                _client.SendAsync(_message, userState);
            }
            catch (Exception e)
            {
                CreateDialog(e.Message);
            }
        }
Example #3
0
 private void m5_Click(object sender, RoutedEventArgs e)
 {
     var tr          = new TextRange(_rtb.Document.ContentStart, _rtb.Document.ContentEnd);
     var emailDialog = new EmailDialog(tr.Text);
 }
Example #4
0
 private void m5_Click(object sender, RoutedEventArgs e)
 {
     var tr = new TextRange(_rtb.Document.ContentStart, _rtb.Document.ContentEnd);
     var emailDialog = new EmailDialog(tr.Text);
 }