如何从Godaddy托管的asp.net网站发送电子邮件? [英] How do I send emails from asp.net site that is hosted on Godaddy?

查看:90
本文介绍了如何从Godaddy托管的asp.net网站发送电子邮件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了一个asp.net网站,其中包含一个向帐户发送电子邮件的联系表单。它在我的机器上本地工作,但当我将它部署到Godaddy时,它不起作用并引发异常:



连接尝试失败,因为连接方没有一段时间后正确响应,或者建立的连接失败,因为连接的主机无法响应198.37.144.225:587



Godaddy说它必须在我的最后。



我已经阅读了谷歌提供的每一篇文章,并多次联系Godaddy寻求支持,但无济于事。



有没有人有任何建议,链接或示例他们目前在godaddy上托管的ASP.Net 4.5 C#网站上工作?



这是我的拥有:



I have created an asp.net site that has a contact form that sends an email to an account. It works locally on my machine, but when I deploy it to Godaddy, it does not work and throws an exception:

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 198.37.144.225:587

Godaddy says it must be on my end.

I have read just about every article that google offers and have contacted Godaddy several times for support with no avail.

Does anyone have any advice, links, or examples they currently have working on an ASP.Net 4.5 C# site hosted on godaddy?

Here is what I have:

SmtpClient smtp = new SmtpClient();

          smtp.Host = "smtpout.secureserver.net";
          smtp.Port = 465;
          smtp.EnableSsl = true;
          smtp.DeliveryMethod = SmtpDeliveryMethod.Network;
          smtp.UseDefaultCredentials = false;
          smtp.Credentials = new System.Net.NetworkCredential("name@mydomain.com", "password");

          MailMessage mailMsg = new MailMessage();
          mailMsg.From = new MailAddress("name@mydomain.com");
          mailMsg.To.Add(new MailAddress("diffname@yahoo.com"));
          mailMsg.ReplyTo = new MailAddress("name@mydomain.com");
          mailMsg.Subject = "New contact message from site";
          mailMsg.Body = string.Format("Name: {0}<br /><br /> Phone number: {1}<br /><br /> Email: {2}<br /><br />" +
          "Subject:{3}", name, phone ?? "None provided", from, subject);
          mailMsg.DeliveryNotificationOptions = DeliveryNotificationOptions.OnFailure;
          smtp.Send(mailMsg);





我也试过:





I have also tried:

SmtpClient smtp = new SmtpClient();

          smtp.Host = "relay-hosting.secureserver.net";
          smtp.DeliveryMethod = SmtpDeliveryMethod.Network;

          MailMessage mailMsg = new MailMessage();
          mailMsg.From = new MailAddress("name@mydomain.com");
          mailMsg.To.Add(new MailAddress("name@yahoo.com"));
          mailMsg.ReplyTo = new MailAddress("name@mydomain.com");
          mailMsg.Subject = "New contact message from site";
          mailMsg.Body = string.Format("Name: {0}<br /><br /> Phone number: {1}<br /><br /> Email: {2}<br /><br />" +
          "Subject:{3}", name, phone ?? "None provided", from, subject);
          mailMsg.DeliveryNotificationOptions = DeliveryNotificationOptions.OnFailure;
          smtp.Send(mailMsg);

推荐答案

您好,



我使用godaddy和这就是我做的,它完美地运作:



Hello,

I use godaddy and this is what I do, it works perfectly:

SmtpClient client = new SmtpClient(host);
NetworkCredential credentials = new NetworkCredential(user, password);

client.UseDefaultCredentials = false;
client.Credentials = credentials;

client.Send(message);





我的主机是smtpout.europe.secureserver.net,端口是3535



Valery。



my host is smtpout.europe.secureserver.net and the port is 3535

Valery.


这篇关于如何从Godaddy托管的asp.net网站发送电子邮件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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