Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Net.Mail; // HERE!
- using System.Text;
- using System.Threading.Tasks;
- namespace MyMail
- {
- class Program
- {
- static void Main(string[] args)
- {
- SmtpClient client = new SmtpClient();
- client.Port = 587;
- client.DeliveryMethod = SmtpDeliveryMethod.Network;
- client.UseDefaultCredentials = false;
- client.Credentials = new System.Net.NetworkCredential("yaroslaw@live.ru", "pass");
- client.Host = "smtp.live.com";
- client.EnableSsl = true;
- MailMessage mail = new MailMessage("yaroslaw@live.ru", "knitershift@gmail.com");
- mail.Subject = "this is a test email.";
- mail.Body = "this is my test email body";
- client.Send(mail);
- //var mail = new MailMessage();
- //mail.From = new MailAddress("youremail@hotmail.com");
- //mail.To.Add("to@gmail.com");
- //mail.Subject = "Test Mail - 1";
- //mail.IsBodyHtml = true;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement