我试图将我的电子邮件保存在本地目录中。 这是我在web.config中的代码
<system.net>
<mailSettings>
<smtp deliveryMethod="SpecifiedPickupDirectory">
<network host="localhost" />
<specifiedPickupDirectory pickupDirectoryLocation="c:\Temp\mail\"/>
</smtp>
</mailSettings>
</system.net>
我没有收到错误,但邮件不在指定的目录中。邮件有可能最终出现在(垃圾邮件)过滤器中吗?
答案 0 :(得分:0)
我怀疑你有<network>
和<specifiedPickupDirectory>
元素都存在问题。删除<network>
。
这是一个有效的例子: 的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