sending email using c#
using System;
using System.Windows.Forms;
using System.Net.Mail;
namespace WindowsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
try
{
MailMessage mail = new MailMessage();
SmtpClient SmtpServer = new SmtpClient("smtp.gmail.com");
mail.From = new MailAddress("[email protected]");
mail.To.Add("to_address");
mail.Subject = "Test Mail";
mail.Body = "This is for testing SMTP mail from GMAIL";
SmtpServer.Port = 587;
SmtpServer.Credentials = new System.Net.NetworkCredential("username", "password");
SmtpServer.EnableSsl = true;
SmtpServer.Send(mail);
MessageBox.Show("mail Send");
}
catch (Exception ex)
{
MessageBox.Show(ex.ToString());
}
}
}
}
Also in C#:
- gfortran: declare an array
- c# get index of item in list
- unity custom update
- download file from url asp net web api c#
- unity get data from firebase
- c# function
- write last line txt file c#
- string to guid c#
- nunit return parameter
- switch case c# contains
- or in unity
- winforms c# add data to datagridview with a button
- c# multiple catch exceptions
- c sharp split by newline
- c# quaternion eular calculator
- repeat 10 timesw c#
- change textbox location C#
- c# declare an int list
- dontdestroyonload unity
- c# generic abstract method
- c# list to string comma separated
- asp.net core 3.1: cast jObject to dictionary<string,string>
- set decimal point c#
- unity html get request