在.NET MVC中使用附件发送电子邮件的问题 [英] Problem with sending email with attachement in .NET MVC

查看:79
本文介绍了在.NET MVC中使用附件发送电子邮件的问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图在.net mvc中使用带有pdf附件的smtp发送电子邮件(在内存附件中),它在本地主机上运行,​​但是当我们在IIS服务器上进行调整时会出现以下异常。



system.net.mail.smptp例外'发送邮件失败'



我尝试了什么: < br $> b $ b

i am tried to send an email using smtp in .net mvc with pdf attachment (in memory attachment), its working on local host but when we deplyed on IIS server geting the following exception.

system.net.mail.smptp exception 'failure sending mail'

What I have tried:

http://stackoverflow.com/questions/279953/how-to-send-an-email-with-attachments-using-smtpclient-sendasync

http://stackoverflow.com/questions/15017132/how-to-send-email-with-attachment-in-asp-net

推荐答案





首先应该可以从托管服务器访问SMTP服务器。



从托管服务器以管理员模式打开CMD后输入以下命令



Telnet [SMTP服务器IP /名称] [端口]



如果它无法访问,那么作为你的infra人来做必要的事情。
Hi,

First the SMTP server should be accessible from the hosted server.

Type below command after opening CMD in administrator mode from hosted server

Telnet [SMTP Server IP / Name] [Port]

if its not accessible then as your infra guy to do the needful.


这篇关于在.NET MVC中使用附件发送电子邮件的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆