Programming Journal C#, Java, SQL and to a lesser extent HTML, CSS, XML, and regex. I made this so other programmers could benefit from my experience.

Monday, November 5, 2007

Setup an email form for .NET 2.0

Here is how I setup the email action for .NET 2.0. I included "using System.Net.Mail;" and "using System.Net;"

string sTo = "";
string sFrom = txtFrom.Text.Trim();
string sSubject = "inforequest message" + DateTime.Now.ToLongDateString();
string sBody = txtContent.Text.Trim();
lblStatus.Text = "Sending... please wait";
MailMessage msg = new MailMessage(sFrom, sTo, sSubject, sBody);
msg.IsBodyHtml = false;
SmtpClient mailObj = new SmtpClient("");
mailObj.Credentials = new NetworkCredential("user", "secret");
lblStatus.Text = "Sent " + msg.Subject + " to " + msg.To;

references: link
Note: I used "localHost" instead of "".

1 comment:

Anonymous said...

Zu diesem Thema sagen es kann lange. viagra online bestellen rezeptfrei cialis online [url=http//]viagra online[/url]