I am writing a code for an email
every thing is perfect but i am getting error like method name expected can u pls help me in this
MailMessage Email = new MailMessage()
{
Subject = "email from",
body = txtMessage.Text,
from = new MailAddress(txtEmail.Text, txtName.Text)
};
Email.To.Add(new MailAddress("[email protected]","prashanthi"));
SmtpClient server = new SmtpClient();
server.Send(Email);

Suthish NairRank #92 · 22.8K reputationPosted Oct 9, 2010, 11:21 AM EDT
using System.Net.Mail; MailMessage objMail = new MailMessage(); objMail = new MailMessage(MailFrom, MailTo, Subject, Body); objMail.IsBodyHtml = true; objMail.Priority = MailPriority.High; System.Net.Mail.SmtpClient sc = null; sc = new System.Net.Mail.SmtpClient(); sc.Host = "1.1.1.1"; //Host IP sc.Send(objMail);you can also use gmail for sending mails.. refer article:
http://www.c-sharpcorner.com/UploadFile/prathore/2464/Default.aspx
Sam HobbsRank #108 · 20.5K reputationPosted Oct 9, 2010, 5:09 PM EDT
I don't understand the brackets ("{" and "}"). That indicates to me that there is code that is relevant to the problem that you are not showing.
I don't know what "Subject", "body" and "from" are.
Most imprtantly, I don't know what line of your code is getting the error.