Click here to Skip to main content
14,601,062 members
Rate this:
Please Sign up or sign in to vote.
See more:
Please i need a code for email sending using yahoo smtp server using localhost !!!

i have gmail smtp server using local host code which is working working perfectly but the same is not not working for yahoo... :(

Help needed :)


Thanks :)
JakirBB 30-Jun-12 4:05am
Do you want to send email using a yahoo or other mail service providers?
Harsha Dev 30-Jun-12 4:09am
using yahoo service!!! :)

1 solution

Rate this:
Please Sign up or sign in to vote.

Solution 1

You can try this.

static void Main(string[] args)
            SmtpMail oMail = new SmtpMail("TryIt");
            SmtpClient oSmtp = new SmtpClient();
            // Your yahoo email address
            oMail.From = "";

            // Set recipient email address
            oMail.To = "";
            // Set email subject
            oMail.Subject = "test email from yahoo account";
            // Set email body
            oMail.TextBody = "this is a test email sent from c# project with yahoo.";

            // Yahoo SMTP server address
            SmtpServer oServer = new SmtpServer("");

            // For example: your email is "", then the user should be ""
            oServer.User = "";
            oServer.Password = "yourpassword";

            // Because yahoo deploys SMTP server on 465 port with direct SSL connection.
            // So we should change the port to 465.
            oServer.Port = 465;
            // detect SSL type automatically
            oServer.ConnectType = SmtpConnectType.ConnectSSLAuto;

                Console.WriteLine("start to send email over SSL ...");
                oSmtp.SendMail(oServer, oMail);
                Console.WriteLine("email was sent successfully!");
            catch (Exception ep)
                Console.WriteLine("failed to send email with the following error:");

If this don't help you somehow you can check here

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

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100