【问题标题】:SMTP Pickup directory not workingSMTP 分拣目录不起作用
【发布时间】:2015-03-08 00:16:36
【问题描述】:

我正在尝试将我的电子邮件保存在本地目录中。 这是我在 web.config 中的代码

<system.net>
  <mailSettings>
    <smtp deliveryMethod="SpecifiedPickupDirectory">
        <network host="localhost" />
        <specifiedPickupDirectory pickupDirectoryLocation="c:\Temp\mail\"/>
    </smtp>
  </mailSettings>
</system.net>

我没有收到错误,但邮件不在指定的目录中。邮件有可能最终进入(垃圾邮件)过滤器吗?

【问题讨论】:

    标签: asp.net smtpclient


    【解决方案1】:

    我怀疑您同时拥有&lt;network&gt;&lt;specifiedPickupDirectory&gt; 元素的事实存在问题。删除&lt;network&gt;

    这是一个工作示例: web.config

     <system.net>
        <mailSettings>
          <smtp from="HelloWorld@yourdomain.com" deliveryMethod="SpecifiedPickupDirectory">
            <specifiedPickupDirectory pickupDirectoryLocation="c:\dcs\smtp" />
          </smtp>
        </mailSettings>
      </system.net>
    

    背后的代码(VB):

       Protected Sub startMailing(sender As Object, e As EventArgs) Handles Button2.Click
            Dim msg As New System.Net.Mail.MailMessage()
            Dim smtpSrvr As New SmtpClient
            msg.To.Add("wylie@acme.com")
            msg.Subject = "Fish Goes paddling Down the stream."
            msg.Body = "Row Row Row Row"
            smtpSrvr.Send(msg)
        End Sub
    

    【讨论】:

    • 当我删除它时,我收到错误,例如找不到 smtp 主机。
    猜你喜欢
    • 1970-01-01
    • 2017-02-11
    • 2021-12-19
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-03-23
    相关资源
    最近更新 更多