电子邮件发送Yahoo邮件 [英] Email Sending Yahoo Mail

查看:107
本文介绍了电子邮件发送Yahoo邮件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

请我需要使用localhost的yahoo smtp服务器发送电子邮件的代码!!!

我有使用本地主机代码的gmail smtp服务器,它可以正常工作,但对于yahoo ...同样不起作用... :(

需要帮助:)

问候
哈莎

谢谢:)

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 :)

Regards
Harsha

Thanks :)

推荐答案

您可以尝试一下.

You can try this.

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

            // Set recipient email address
            oMail.To = "support@emailarchitect.net";
            
            // 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("smtp.mail.yahoo.com");

            // For example: your email is "myid@yahoo.com", then the user should be "myid@yahoo.com"
            oServer.User = "myid@yahoo.com";
            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;

            try
            {
                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:");
                Console.WriteLine(ep.Message);
            }
        }



如果这不能以某种方式帮助您,则可以检查



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


这篇关于电子邮件发送Yahoo邮件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆