Answers for "envoi email en c#"

C#
0

envoi email en c#

private void button1_Click(object sender, EventArgs e)
        {
            MailMessage email = new MailMessage();
            email.From = new System.Net.Mail.MailAddress("[email protected]");
            email.To.Add(new MailAddress("[email protected]"));
            email.IsBodyHtml = true; 
            email.Subject = "objet du mail";
            email.Body = "  contenu du mail";
            System.Net.Mail.SmtpClient smtp = new System.Net.Mail.SmtpClient();
            smtp.Host = "smtp.gmail.com";
            smtp.Credentials = new System.Net.NetworkCredential("source", "mot-de-passe");
            try
            {
                smtp.Send(email);
                MessageBox.Show("email est envoyer");
            }
            catch (SmtpException ex)
            {
                MessageBox.Show(ex.Message);
            } 
           
           
        }
Posted by: Guest on February-25-2021

C# Answers by Framework

Browse Popular Code Answers by Language