如何使用 System.Net.Mail 将带有大附件的邮件发送到 Google Apps?

发布于 2024-09-01 23:35:04 字数 609 浏览 8 评论 0原文

我正在尝试发送带有大附件(1MB,2MB)的邮件。 但发送邮件失败。(发送到 Google Apps)为:

MailItemEntry[] entries = new MailItemEntry[1];
String EmlPath = "C:\\testemail.eml";                                        
String msg = File.ReadAllText(EmlPath);
entries[0] = new MailItemEntry();
entries[0].Rfc822Msg = new Rfc822MsgElement(msg);

How can i split Attachs into multipart?

将此 EML 迁移到 Google 应用程序时遇到的异常是: {“请求已中止:请求已取消。”}

Google 论坛上的问题

I am trying to send mail with large size attachment upto (1MB,2MB).
But sending mail fails.(Sending to Google Apps) as:

MailItemEntry[] entries = new MailItemEntry[1];
String EmlPath = "C:\\testemail.eml";                                        
String msg = File.ReadAllText(EmlPath);
entries[0] = new MailItemEntry();
entries[0].Rfc822Msg = new Rfc822MsgElement(msg);

How can i divide attachments into multi part?

Exception I am getting while migrating this EML to Google apps is:
{"The request was aborted: The request was canceled."}

Question on Google Forum

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

℡Ms空城旧梦 2024-09-08 23:35:04

一种解决方案可能是使用多部分 zip(或支持类似概念的其他压缩格式)文件并通过单独的电子邮件发送每个文件。

至少,GZip 也支持多部分压缩,尽管我不认为 zip 或 gz 在 .NET 中对多部分文件有很好的支持。

您最好的选择可能是 #ziplib

One solution may be to use multipart zip (or other compression format that supports a similar concept) files and send each file in a seperate email.

At the least, GZip supports multipart compression as well, though I don't think either zip or gz have really good support in .NET for multipart files.

Your best bet for either is probably #ziplib.

浅听莫相离 2024-09-08 23:35:04

如果您尝试发送例如 2MB WMV 文件,而您的邮件网关仅允许 ~500kb 附件,则这是行不通的。您不能任意分割 WMV 文件 - 电子邮件收件人需要相同的软件来“连接”各个片段。

WinRAR 等存档实用程序允许您将创建的存档分割成可配置大小的块。然后,您可以在一封电子邮件中发送大量附件,也可以发送带有单个附件的大量电子邮件。

一个更简单的解决方案是将文件上传到某个地方,然后在电子邮件中添加一个链接,以便稍后下载该文件。这可能是您自己的 HTTP 或 FTP 服务器,或者有大量的第三方服务可以让您做到这一点,YouSendIt 似乎很受欢迎。

If you're trying to send, e.g. a 2MB WMV file and your mail gateway only allows ~500kb attachments, this just isn't going to work. You can't arbitrarily split a WMV file - the email recipient would need the same software to 'join' the pieces back up.

There are archive utilities such as WinRAR that allow you to created archives split into configurable sized chunks. Then you could either send lots of attachments in one email, or lots of emails with single attachments.

An easier solution would be to upload the file somewhere and put a link in the email to download the file later. This could be your own HTTP or FTP server, or there is an abundance of 3rd party services out there that let you do just this, YouSendIt seems popular.

百变从容 2024-09-08 23:35:04

我知道这并不完全是一个答案,但在我的测试中,我能够毫无问题地发送最大 3MB 的附件。您确定没有遇到 smtp 主机对出站附件大小施加的限制吗?

I know this isn't exactly an answer, but in my testing, I was able to send attachments up to 3MB in size without a problem. Are you sure you're not running into a limitation imposed by your smtp host on outbound attachment sizes?

唠甜嗑 2024-09-08 23:35:04

在每个人都白费力气之前,原始发布者实际上可以发布他们所看到的异常文本吗?

这可能是任何原因,从网络服务器超时、邮件服务器不接受大附件到没有适当的权限。

如果没有看到异常文本和堆栈跟踪,这些浮夸的问题可能是徒劳的。

无意粗鲁或其他什么,但问题提供的信息越多,就越容易回答。

Before everyone goes on a wild goose chase, can the original poster actually post the exception text they are seeing?

This could be anything from the web server timing out, to the mail server not accepting large attachments, to not having proper permissions.

Without seeing the exception text, and stack trace, these vauge questions can be a exercise in futility.

Not trying to be rude or anything, but the more information provided with a question, the easier it is to answer.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文