c# send email
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#:
- how do loops on C#
- unity how to get transform scale
- leantween id
- c# get motherboard id
- c# region tag
- ecs get specific entities with component
- interop C# save as and replace
- import regex c#
- c# counting lines
- unity indestructible
- unity how to set an objects postion x,y,z
- c# rsa example
- parse strings into words C#
- 2d movement unity
- attribute usage c#
- switch case c# range
- create new object from generic c#
- c# implement a superclass in subclass
- c# how to run external program
- c# object list attribute to string
- how to make if statement c#
- initialise icollection c#
- c# odd even median
- c# linq to get most recent item from IList