How to send email using Gmail from C# - CSharp - Microsoft ASP Solutions

Share:

How to Send Email using Gmail in C# ASP.Net


  • Sending Email Using C# - C# Microsoft ASP Solutions
  • Send Email using SMTP in C#
  • Simple code for send email with C# | Microsoft ASP Solutions
  • How to send email in ASP.NET C#
  • C# - Send Email using Gmail SMTP Server
  • Sending email in .NET through Gmail
  • Sending email through Gmail SMTP server with C#
  • How to send an e-mail with C# through Gmail | Microsoft ASP Solutions
  • Sending mail through C# with gmail is not working
  • Send email using GMAIL SMTP Server using C#


CS Page Code Below


 
protected void Button1_Click(object sender, EventArgs e)
    {
        string username = "";
        string password = "";
        string From_Email = "Your Gmail Id";
        string pass = "Password";

        string To_Email = "Your Email";

        MailMessage mm = new MailMessage(From_Email, To_Email);
        mm.Subject = "Contact Form";
        mm.Body = string.Format("

Company Name : " + TextBox1.Text + "

Email : " + TextBox2.Text + "

Mobile : " + TextBox3.Text + "

Message : " + TextArea1.Text + "

", username, password); mm.IsBodyHtml = true; SmtpClient smtp = new SmtpClient(); smtp.Host = "smtp.gmail.com"; smtp.EnableSsl = false; NetworkCredential NetworkCred = new NetworkCredential(); NetworkCred.UserName = From_Email; NetworkCred.Password = pass; smtp.UseDefaultCredentials = true; smtp.Credentials = NetworkCred; smtp.Port = 587; smtp.Send(mm); lblMess.Text = "Your Request Send."; lblMess.Visible = true; }


NOTE :

Go to this url login your gmail https://myaccount.google.com/lesssecureapps Trun On This Setting Your Mail Send Problem Resolve


 

No comments