Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- SmtpClient smtp = new SmtpClient("smtp.myoutlook.ru", 587);
- using (MailMessage message = new MailMessage())
- {
- string FromAddr = "from";
- string ToAddr = "to";
- bool EnableSSL = false;
- string Login = "login";
- string Password = "pass";
- Encoding encoding = System.Text.Encoding.GetEncoding("windows-1251");
- message.IsBodyHtml = false;
- message.SubjectEncoding = encoding;
- message.BodyEncoding = encoding;
- MessageBox.Show("From address: " + FromAddr);
- message.From = new MailAddress(FromAddr, encoding);
- message.Bcc.Add(new MailAddress(ToAddr, encoding));
- message.Subject = "Subject";
- message.Body = "Body";
- smtp.UseDefaultCredentials = false;
- smtp.EnableSsl = EnableSSL;
- MessageBox.Show("Enable SSL is: " + EnableSSL.ToString());
- if (!String.IsNullOrEmpty(Login) &&
- !String.IsNullOrEmpty(Password))
- {
- MessageBox.Show("Login is " + Login);
- smtp.Credentials = new System.Net.NetworkCredential(Login, Password);
- }
- smtp.DeliveryMethod = SmtpDeliveryMethod.Network;
- smtp.Send(message);
Add Comment
Please, Sign In to add comment