Hi ahsan.ali,
Refer the below link and below code is for sending from hotmail.
C#
protected void Button1_Click(object sender, EventArgs e)
{
using (MailMessage mm = new MailMessage("fromemail@hotmail.co.in", "toemail@hotmail.co.in"))
{
mm.Subject = "Test Subject";
mm.Body = "Test Body";
mm.IsBodyHtml = false;
SmtpClient smtp = new SmtpClient();
smtp.Host = "smtp.live.com";
smtp.EnableSsl = true;
NetworkCredential NetworkCred = new NetworkCredential("fromemail@hotmail.co.in", "hotmailpassword");
smtp.UseDefaultCredentials = true;
smtp.Credentials = NetworkCred;
smtp.Port = 25;
smtp.Send(mm);
}
}
VB.Net
Protected Sub Button1_Click(sender As Object, e As EventArgs)
Using mm As New MailMessage("fromemail@hotmail.co.in", "toemail@hotmail.co.in")
mm.Subject = "Test Subject"
mm.Body = "Test Body"
mm.IsBodyHtml = False
Dim smtp As New SmtpClient()
smtp.Host = "smtp.live.com"
smtp.EnableSsl = True
Dim NetworkCred As New NetworkCredential("fromemail@hotmail.co.in", "hotmailpassword")
smtp.UseDefaultCredentials = True
smtp.Credentials = NetworkCred
smtp.Port = 25
smtp.Send(mm)
End Using
End Sub