gpt4 book ai didi

amazon-web-services - 从 AWS SES 发送附件小于 10 MB 的电子邮件

转载 作者:行者123 更新时间:2023-12-03 22:50:34 24 4
gpt4 key购买 nike

我们正在使用 AWS SES 从我们的 C# 应用程序发送电子邮件。我们有一个大小为 9.28MB 的附件(PDF 文件),当我们尝试发送带有附件的电子邮件时,它抛出以下异常:

System.Xml.XmlException: Root element is missing. at System.Xml.XmlTextReaderImpl.Throw(Exception e) at System.Xml.XmlTextReaderImpl.ParseDocumentContent() at Amazon.Runtime.Internal.Transform.UnmarshallerContext.Read() at Amazon.Runtime.Internal.Transform.ErrorResponseUnmarshaller.Unmarshall(UnmarshallerContext context) at Amazon.SimpleEmail.Model.Transform.SendRawEmailResponseUnmarshaller.UnmarshallException(UnmarshallerContext context, Exception innerException, HttpStatusCode statusCode) at Amazon.Runtime.AmazonWebServiceClient.processWebException[X,Y](String requestName, WebException we, HttpWebRequest webRequest, IResponseUnmarshaller`2 unmarshaller, IRequest`1 request, Int32 retries) at Amazon.Runtime.AmazonWebServiceClient.Invoke[X,Y](IRequest`1 request, AbstractAWSSigner signer, IResponseUnmarshaller`2 unmarshaller) at Amazon.SimpleEmail.AmazonSimpleEmailServiceClient.SendRawEmail(SendRawEmailRequest sendRawEmailRequest) at MyApp.AmazonSESWrapper.SendRawEmail(String awsAccessKey, String awsSecretKey, List`1 to, List`1 cc, List`1 bcc, String senderEmailAddress, String replyToEmailAddress, String subject, String body, String text, String filePath, String exceptionDetails)

但是当我们发送一个 7.50MB 的 word 文档作为附件时,我们得到以下异常:
Amazon.SimpleEmail.AmazonSimpleEmailServiceException: Message length is more than 10485760 bytes long: '10788624'. ---> System.Net.WebException: The remote server returned an error: (400) Bad Request. at System.Net.HttpWebRequest.GetResponse() at Amazon.Runtime.AmazonWebServiceClient.Invoke[X,Y](IRequest`1 request, AbstractAWSSigner signer, IResponseUnmarshaller`2 unmarshaller) --- End of inner exception stack trace --- at Amazon.Runtime.AmazonWebServiceClient.processWebException[X,Y](String requestName, WebException we, HttpWebRequest webRequest, IResponseUnmarshaller`2 unmarshaller, IRequest`1 request, Int32 retries) at Amazon.Runtime.AmazonWebServiceClient.Invoke[X,Y](IRequest`1 request, AbstractAWSSigner signer, IResponseUnmarshaller`2 unmarshaller) at Amazon.SimpleEmail.AmazonSimpleEmailServiceClient.SendRawEmail(SendRawEmailRequest sendRawEmailRequest) at 

从论坛和常见问题解答中,它说最大附件大小为 10MB,但小于 10MB 的附件也会出现错误。

https://forums.aws.amazon.com/thread.jspa?messageID=346305

http://aws.amazon.com/ses/faqs/#49

请就此提出建议。

最佳答案

还有整体消息大小限制,也是10M。根据 http://aws.amazon.com/ses/faqs/ :

Amazon SES will accept email messages up to 10 MB in size. This includes any attachments that are part of the message.



因此,您必须确保您的请求符合这些限制。

(我个人认为这是 Amazon API 抛出“XmlException: Root element is missing.”的错误。以防消息大小大大超过限制。这完全是误导。)

关于amazon-web-services - 从 AWS SES 发送附件小于 10 MB 的电子邮件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17648527/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com