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;
- using System.Net.Mail;
- using System.Text;
- using System.Threading.Tasks;
- namespace ConsoleApplication6
- {
- class Program
- {
- static void Main(string[] args)
- {
- try
- {
- MailMessage message = new MailMessage();
- SmtpClient smtp = new SmtpClient();
- message.From = new MailAddress("letmelearn11@gmail.com");
- message.To.Add(new MailAddress("amitziv99@gmail.com"));
- message.Subject = "Subject 199";
- message.Body = "hello askkskksksks";
- smtp.Port = 587;
- smtp.Host = "smtp.gmail.com";
- smtp.EnableSsl = true;
- smtp.UseDefaultCredentials = false;
- smtp.Credentials = new NetworkCredential("letmelearn11@gmail.com", "thepassword");
- smtp.DeliveryMethod = SmtpDeliveryMethod.Network;
- smtp.Send(message);
- }
- catch (Exception ex)
- {
- Console.WriteLine("err: " + ex.Message);
- }
- Console.ReadKey();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement