asp.net email fails on server when file attached
The email goes suc开发者_运维问答eessfully when I send it from localhost and use an external smtp settings, but email never goes when I run the code on live server and email has attachment. In web.config I have:
<system.net>
<mailSettings>
<smtp>
<network host="localhost" />
</smtp>
</mailSettings>
</system.net>
This problem only arises on live site with email attachment. It works fine on localhost with or without attachment.
I'm not sure, but it could be a problem with your web.config settings. Did you have something like:
<location path="email" allowOverride="false">
<system.web>
<httpRuntime executionTimeout="300" maxRequestLength="15360" />
</system.web>
</location>
If your aspx file is under a dir named "email".
This code helped me:
Dim client As New SmtpClient()
client.Host = "relay.neural.net.au"
Try
client.Send(mailMsg)
精彩评论