Click here to Skip to main content
15,885,537 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Now i wrote below coding after u said.
-----------------------------------------------
C#
MailMessage Emailmsg = new MailMessage();
                    Emailmsg.From = new MailAddress("jothi.mscit87@gmail.com", "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<hr>Test test</body></html>";
                    Emailmsg.IsBodyHtml   = true;
                    Emailmsg.Priority   = MailPriority.Normal;
                    SmtpClient MailClient = new SmtpClient("localhost",1073);
                    MailClient.Credentials = new System.Net.NetworkCredential("jothi.rjk05@yahoo.in","Password");
                    MailClient.Send(Emailmsg);

                    error.Text = "Your email was sent";
                }
                catch
                {
                    error.Text = "your mail not send";
Posted
Updated 26-Jan-14 20:27pm
v2
Comments
Mehdi Gholam 25-Jan-14 4:12am    
Who are you talking to?
Richard MacCutchan 25-Jan-14 4:24am    
Please reply to the person who gave you some suggestions, rather than opening a new question.

HTML
SmtpClient client = new SmtpClient("smtp.gmail.com", 587);
        client.DeliveryMethod = SmtpDeliveryMethod.Network;
        client.EnableSsl = true;
        System.Net.NetworkCredential credentials =
            new System.Net.NetworkCredential("EmailID@gmail.com", "Password");
        client.UseDefaultCredentials = false;
        client.Credentials = credentials;
        MailMessage msg = new MailMessage();
        msg.From = new MailAddress("EmailID@gmail.com");
        msg.To.Add(new MailAddress(SendToEmailId@yahoo.com));
        msg.Body = "<html><body>This is a testTest test</body></html>";
        msg.Subject = "Testing";
        msg.IsBodyHtml = true;
        client.Send(msg);
 
Share this answer
 
If you are sending your email via Yahoo.com then you should use their address and settings not "localhost":
http://email.about.com/od/accessingyahoomail/f/Yahoo_Mail_SMTP_Settings.htm[^]
C#
SmtpClient MailClient = new SmtpClient("smtp.mail.yahoo.in",465);
MailClient.Credentials = new System.Net.NetworkCredential("jothi.rjk05@yahoo.in","Password");
 
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