本文介绍了发送带有附件的电子邮件时出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在从网站发送电子邮件.该电子邮件包含附件.
这些附件是存在于名为upload
I am sending email from site. This email contains an attachment.
.These attachments is file existing on folder called upload
this is the code for generate attachment list:
List _attchmentlist = new List();
foreach (PersonalFile row in _list)
{
string FilePath = "~/Upload/" + row.FileID;
string path = this.Server.MapPath(FilePath);
System.IO.FileInfo file = new System.IO.FileInfo(path);
FileStream fs = file.OpenRead();
Attachment at = new Attachment(fs, row.FileName); ;
_attchmentlist.Add(at);
}
它可以很好地处理图像,但是当我尝试发送zip文件或mp3文件时
它会提示我发送失败".
当我遵循该错误时,我发现了以下执行
索引超出范围
因此,文件大小或类型是否有限制?
It works fine with images, but when I try to send zip file or mp3 file
it get me message "sending failed".
When I follow the error, I found the following execption
index was out of range
So, is there any limit on file size or type?
推荐答案
<httpRuntime maxRequestLength="1048576" executionTimeout="360"/>
或问题可能是由iis引起的.进一步了解maxAllowedContentLength.
还要检查
or the issue can be cause by the iis. Read more about maxAllowedContentLength.
also check the link
这篇关于发送带有附件的电子邮件时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!