我是一个网站编程。我想在配置文件中发送一条消息给用户..现在在asp.net ..我把这个:我如何获得我的smtp主机?
<mailSettings>
<smtp from="[email protected]">
<network host="localhost" port="25" userName="username" password="secret" defaultCredentials="true" />
</smtp>
</mailSettings>
我不知道它是如何在网络主机行为和什么呢..我想要将其更改为保存我的雅虎帐户的服务器。我明白,smtp是一些电子邮件服务器,发送电子邮件了..但我如何把它获得?它看起来怎样,?它是一个int,它是一个字符串吗?!?
MailMessage message = new MailMessage();
message.From = new MailAddress("[email protected]");
message.To.Add(new MailAddress("[email protected]"));
message.CC.Add(new MailAddress("[email protected]"));
message.Subject = "This is my subject";
message.Body = "This is the content";
SmtpClient client = new SmtpClient();
client.Send(message);
配置文件:
<mailSettings>
<smtp from="[email protected]">
<network host="smtp.yahoo.com" port="25" userName="username" password="secret" defaultCredentials="true" />// where do i get the host?!? the host prevents me from sending an email
</smtp>
</mailSettings>
这取决于你想使用什么smtp服务器......如果它是你想使用的ISP的smtp服务器,你可以问你的isp(或搜索他们的网站)。雅虎或任何其他邮件服务也是如此。你必须从他们(即他们的支持网站)获得正确的smtp服务器。 – fretje 2011-05-10 09:50:07
另外:这是堆栈溢出的主题。超级用户或WebApps可能会更好。 – fretje 2011-05-10 09:51:05