如何获取我的 smtp 主机?

发布于 2024-11-05 19:29:51 字数 1823 浏览 1 评论 0原文

我编写了一个网站。我想向用户发送一条消息..现在在配置文件中的asp.net中..我这样写:

<mailSettings>

  <smtp from="[email protected]">

    <network host="localhost" port="25" userName="username" password="secret" defaultCredentials="true" />

  </smtp>

</mailSettings>

我不知道网络主机的行为方式以及它的作用..我想将其更改为服务器那保存着我的雅虎帐户。我知道 smtp 是一些发送电子邮件的电子邮件服务器..但我如何获取它?它看起来怎么样?它是一个整数,还是一个字符串?!?

 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>

i program a site. and i want to send a message to the user.. now in asp.net in the config file.. i put this:

<mailSettings>

  <smtp from="[email protected]">

    <network host="localhost" port="25" userName="username" password="secret" defaultCredentials="true" />

  </smtp>

</mailSettings>

i have no idea how the network host acts and what it does.. i want to change it to the server that holds my yahoo account. i understand that smtp is some email server that sends emails out.. but how do i put obtain it? how does it look like,? is it an int, is it a string?!?

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

config file:

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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

我偏爱纯白色 2024-11-12 19:29:51

看看雅虎!有关 SMTP 服务器设置的邮件帮助页面。看来您需要成为雅虎!然而,Mail Plus 帐户持有者可以访问 POP 和 SMTP 服务器。也许您可以使用另一个邮件帐户 - 您的网络托管提供商的 SMTP 服务器将是最好的选择。阅读网络托管服务商的帮助页面。

Look at Yahoo! Mail help pages for settings for their SMTP server. It looks like you need to be a Yahoo! Mail Plus account holder to access POP and SMTP servers however. Maybe you can use another mail account - your web hosting provider's SMTP server would be the best one to use. Read your web host's help pages.

我也只是我 2024-11-12 19:29:51

网络主机是将处理电子邮件发送的物理服务器(SMTP 服务器)的地址。它可以是IP 地址或域名的形式(例如mail.mydomain.com)。如果您在一家公司工作,他们应该向您提供此信息,

Network host is the address of the physical server (SMTP server) that will handle the sending of email. It could be in a form of IP address or a domain name (e.g. mail.mydomain.com). If you are working on a company they should provide this to you,

瞄了个咪的 2024-11-12 19:29:51
using System.Configuration;
using System.Web.Configuration;
using System.Net.Configuration;

Configuration configurationFile = WebConfigurationManager.OpenWebConfiguration("PathToConfigFile");

选择

configurationFile = WebConfigurationManager.OpenWebConfiguration(HttpContext.Current.Request.ApplicationPath)

MailSettingsSectionGroup mailSettings = configurationFile.GetSectionGroup("system.net/mailSettings") as MailSettingsSectionGroup;
using System.Configuration;
using System.Web.Configuration;
using System.Net.Configuration;

Configuration configurationFile = WebConfigurationManager.OpenWebConfiguration("PathToConfigFile");

Alternative

configurationFile = WebConfigurationManager.OpenWebConfiguration(HttpContext.Current.Request.ApplicationPath)

MailSettingsSectionGroup mailSettings = configurationFile.GetSectionGroup("system.net/mailSettings") as MailSettingsSectionGroup;
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文