Pra*_*sad 3 email-attachments amazon-web-services amazon-ses
我们正在使用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)
Run Code Online (Sandbox Code Playgroud)
但是,当我们发送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
Run Code Online (Sandbox Code Playgroud)
从“论坛”和“常见问题解答”中可以看到,最大附件大小为10MB,但少于10MB的附件也会发生错误。
https://forums.aws.amazon.com/thread.jspa?messageID=346305
http://aws.amazon.com/ses/faqs/#49
请对此提出建议。
小智 5
也有整个邮件大小限制,也就是10M。根据http://aws.amazon.com/ses/faqs/:
Amazon SES将接受最大10 MB的电子邮件。这包括邮件中的所有附件。
因此,您必须确保您的请求符合这些限制。
(我个人认为这是Amazon API抛出“ XmlException:缺少根元素”的错误。以防万一消息大小大大超出了限制。这完全是误导。)
| 归档时间: |
|
| 查看次数: |
5397 次 |
| 最近记录: |