Click here to Skip to main content
16,020,345 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I wrote this coding only
----------------
using System.Net.Mail;

protected void Button1_Click(object sender, EventArgs e)
{
if (txtname.Text.Length<5)
{
error.Text = "please type your name";
}
else if (txtid.Text.Length<5)
{
error.Text = "please type your Mail id";
}
else if (contact.Text.Length<5)
{
error.Text = "Plase type your contact no";
}
else
{
if (dispay.Text.Length > 100)
{
error.Text = "Please type upto 100 character";
}
else
{
try
{
MailMessage Emailmsg = new MailMessage();
Emailmsg.From = new MailAddress("www.qgol.in","plain name");

Emailmsg.To.Add (new MailAddress ("jothi.rjk05@yahoo.in","welcome"));

Emailmsg.Subject ="test email form";


Emailmsg.Body = "<html><body>This is a test
Test test</body></html>";
Emailmsg.IsBodyHtml = true;
Emailmsg.Priority = MailPriority.Normal;
SmtpClient MailClient = new SmtpClient("mail.jothi.rjk05@yahoo.in");
MailClient.Credentials = new System.Net.NetworkCredential("from email address","gud");
MailClient.Send(Emailmsg);

error.Text = "Your email was sent";
}
catch
{
error.Text = "your mail not send";
}
Posted

1 solution

Put your proper credentials in the System.Net.NetworkCredential instead of dummy values... It might help you to sign in, and then the email stabs a chance of going!
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900