或者建立的连接失败

或者建立的连接失败

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

问题描述

protected void Button1_Click(object sender, EventArgs e)
        {
            MailMessage mail = new MailMessage();
            mail.To.Add("[email protected]");
            mail.From = new MailAddress("[email protected]");
            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);
        }

推荐答案



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

09-02 00:57