| TechTasks.net |
The Blog is Moved to www.TechTasks.net
Simple Code For sending Mail Using Net.Mail NameSpace
using System.Net.Mail;
using System.IO;
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void btnsend_Click(object sender, EventArgs e)
{
MailMessage mm = new MailMessage();
mm.From = new MailAddress("rajesh.chekuri@gmail.com");
mm.To.Add(new MailAddress("rajesh.chekuri@gmail.com"));
mm.Subject ="hii";
mm.Priority = MailPriority.High;
mm.Body = "Thanks for Visiting www.funnydotnet.co.cc";
SmtpClient sc = new SmtpClient("localhost");
try
{
sc.Send(mm);
lblnotice.Text = "Mail sended sucessfully";
}
catch (Exception exc)
{
lblnotice.Text = "Send failure: " + exc.ToString();
}
}
}
//// some times it gives error like
//System.Net.Mail.SmtpFailedRecipientException {"Mailbox unavailable. The
////server response was: 5.7.1
////possibly forged [208.179.189.145]"}
////System.Net.Mail.SmtpFailedRecipientException
//solution
//You have to allow relaying in your SMTP server.
//Check security settings in IIS.
//This is dine by right-clicking Default SMTP Virtual Server and choosing
//properties.
//Then go to the Access tab. Click on the Relay button at the bottom of the
//dialog.
//Add the IPs you want to grant access. By default this is turned of
//completely and since your web server is on the same machine, you could add
//127.0.0.1 as the only entry in the list.
//You can also open it up completely by checking the radio button All except
//the list below and leave the list blank. However, if it is a public server
//that is not a recommended setting.
//That should solve that issue.
//some times unchecked need to add this code into web.config
//
//
//
//
//
//
//
Blog Archive
-
▼
2008
(33)
-
►
December
(14)
- Non Editable Rows in GridView
- Validate DropDownList inside GRIDVIEW
- .Net Keyboard Shortcuts
- Grid View Operataions
- FAQ'S & INTERVIEW TIPS
- C#.NET
- ASP.NET
- DOTNET FRAMEWORK
- Projects With Source Code
- Enter Text In Into Two TextBoxes At the Same Time
- Saving Uploaded file into Disk and displaying the ...
- Writing Connection string in web.config file
- Change GridView Row Color When MouseOver
- Working With Command Builder in ASP.NET
-
▼
November
(14)
- JavaScript Validatoin For Basic Controles in ASP.N...
- Dot Net - C#.Net(FAQ'S)
- Dot Net - Asp.Net - Basic II(FAQ'S)
- Dot Net - Asp.Net - Basic I(FAQ'S)
- Famous Books For .NET
- Connecting MySql With Asp.net Using ODBC Drivers
- Simple Calculator In Windows Application Using C#
- Mail Sending Using Net.Mail
- Select All And Delete Using CheckBox In GridView
- GridView DeleteAll,SelectAll,ClearAll(Server Side)...
- GridView Paging & Sorting
- GridView Update,Delete,Adding (Insert) Record...
- Alphabetical Paging in Gridview
- Connecting MySql With C# ASP.NET
-
►
December
(14)


0 comments: