连接尝试失败,因为连接方在一段时间后没有正确响应,或者建立的连接失败,因为连接的主机无法响应173.194.79.109:25 [英] A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond 173.194.79.109:25

查看:102
本文介绍了连接尝试失败,因为连接方在一段时间后没有正确响应,或者建立的连接失败,因为连接的主机无法响应173.194.79.109:25的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

protected void Button1_Click(object sender, EventArgs e)
        {
            MailMessage mail = new MailMessage();
            mail.To.Add("ansontay94@hotmail.com");
            mail.From = new MailAddress("ansontay94@hotmail.com");
            mail.Subject = "Test Mail";
            mail.Body = "This is a test mail....from gmail acc";
            mail.IsBodyHtml = true;

            ////Attach file using FileUpload Control and put the file in memory stream
            //if (FileUpload1.HasFile)
            //{
            //    mail.Attachments.Add(new Attachment(FileUpload1.PostedFile.InputStream, FileUpload1.FileName));
            //}

            SmtpClient smtp = new SmtpClient();
            smtp.Host = "smtp.gmail.com"; //Or Your SMTP Server Address
            smtp.Credentials = new System.Net.NetworkCredential("YourGmailID", "YourGmailPassword"); //Or your Smtp Email ID and Password
            smtp.EnableSsl = true;
            smtp.Port = 25; //If not work, you can use 25 here....
            smtp.Send(mail);
        }

推荐答案

你好,



也许你可以尝试其他端口,587。
Hi there,

Maybe you can try other port, 587.


检查我以前的答案从asp.net发送电子邮件到gmail [ ^ ]。您将找到使用Gmail发送邮件的代码。
Check my previous answer sending email to gmail from asp.net[^]. You will find the code to send mail using Gmail.


这篇关于连接尝试失败,因为连接方在一段时间后没有正确响应,或者建立的连接失败,因为连接的主机无法响应173.194.79.109:25的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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