see the link http://www.thesmartcodes.com/a-simpl...-from-asp-net/

can any one see this and see if it is working if i specify (for example my gmail address and password ,username) in the variable mentioned over there ??

and lastly called sendMail function just

Sorry I can' access the link you mentioned in your post!
I suggest you to try the code below. I used that code in my project before and it worked fine with me.. this is asp.net using c# codes..

try
        {
            MailMessage mail = new MailMessage();
            mail.To.Add("email_add_of_the_receiver@gmail.com");
            mail.From = new MailAddress(email_of the_sender@yahoo.com);// or could be @gmail.com and etc OR it can be a textbox were you CAN enter your email
            mail.Subject = "Comment/Question";
            string Body = the_textbox_Name_were_you_enter_your_message.text;
                mail.Body = Body;
            mail.IsBodyHtml = true;
            SmtpClient smtp = new SmtpClient();
            smtp.Host = "smtp.gmail.com";
            smtp.Port = 587;
            smtp.Credentials = new System.Net.NetworkCredential
              ("email_add_of_the_receiver@gmail.com", "your password");
            smtp.EnableSsl = true;
            smtp.Send(mail);
           
        }
        catch
        {
            
        }

dont forget to include this one:

using System.Net.Mail;

thanks kuracha for ur good reply ,really help me a lot

how about if need to send from msn or yahoo or hotmail ..just chnage following paramters

host ,creential,from ?? (Coorect me if i m worong)

i mgetting an error

{"Failure sending mail."}

i have set certian values in web.config

smtp.Credentials = New System.Net.NetworkCredential("no-reply@gfln.org", "Admin")
smtp.EnableSsl = True


mail.From = New MailAddress(System.Configuration.ConfigurationManager.AppSettings("From").ToString())



' or could be @gmail.com and etc OR it can be a textbox were you CAN enter your email
' mail.Subject = "Comment/Question"
mail.Subject = System.Configuration.ConfigurationManager.AppSettings("EmailSubject").ToString()

this time i m not sending mail via a gmail but website account ,

make sure that you leave the code as is , just provide your username and password it will work

System.Net.NetworkCredential NetworkCred = new System.Net.NetworkCredential();

yes i also provide this line too

smtp.Credentials = New System.Net.NetworkCredential("reciever email", "password of sender")
smtp.EnableSsl = True

is this u r saying

no leave it empty as i provided in the article what you need to change its only the username and password of Gmail

yes i did the same as u saying but still no gain.secondly let me added some thing code.

i need to send mail from administrator of gln.org i.e no-reply@gfln.org.
its password is admin,and send email to its cleint .i hope u got my point, there is some exception {"The remote name could not be resolved: 'smtp.gfln.org'"}

please post back me

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.