First of All You have to set your IIS to let you
send Email.
Setting steps are
- Go to your IIS
- select default SMTP Virtual Server +
right click go to Property.
- Go to general tab+advance +add your
local IP addresss.+ ok.
Now try this code. it will work properly.
When you download code, it also
include IIS setting help in image format.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Net.Mail;
using System.Net;
public partial class _Default :
System.Web.UI.Page
{
protected void Page_Load(object
sender, EventArgs e)
{
}
protected void Button1_Click(object
sender, EventArgs e)
{
SmtpClient ss = new SmtpClient("<Your
Local IP Addres>");
ss.Port = 25;
ss.UseDefaultCredentials =
true;
ss.Send("<From Mail>", "<To
Mail>", "<Subject>", "<Body message>");
}
}
}