加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

使用C#发送没有SMTP服务器的电子邮件?

发布时间:2020-12-16 01:59:12 所属栏目:百科 来源:网络整理
导读:参见英文答案 Sending mail without installing an SMTP server????????????????????????????????????3个 我正在制作一个简单的网站.它托管在我的VPS上,我运行IIS 7并具有完全访问权限. DNS已设置并已配置,但未配置任何邮件服务器或任何内容. 我希望用户能够
参见英文答案 > Sending mail without installing an SMTP server????????????????????????????????????3个
我正在制作一个简单的网站.它托管在我的VPS上,我运行IIS 7并具有完全访问权限. DNS已设置并已配置,但未配置任何邮件服务器或任何内容.

我希望用户能够通过一个非常简单的表单发送反馈.

但是,我没有SMTP服务器(我知道).

string from = "";
    string to = "someemails@hotmail.com";
    string subject = "Hi!";
    string body = "How are you?";
    SmtpMail.SmtpServer = "mail.example.com";
    SmtpMail.Send(from,to,subject,body);

我想将邮件发送到免费的电子邮件帐户,但我不知道如何,因为我没有SMTP服务器.

还有其他方法可以做到吗?或者一些替代方案(比如使用免费的smpt或其他东西)

谢谢

解决方法

作为替代方案,在您的配置文件中,您可以放置

<configuration>
  <system.net>
     <mailSettings>
      <smtp deliveryMethod="SpecifiedPickupDirectory">
        <specifiedPickupDirectory pickupDirectoryLocation="C:somedirectory" />
      </smtp>
     </mailSettings>
  </system.net>
</configuration>

这将导致所有已发送的邮件发送到specifiedPickupDirectory中的磁盘,而不必配置SMTP设置.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读