Ios 亚马逊SES不向Gmail id发送电子邮件;s

Ios 亚马逊SES不向Gmail id发送电子邮件;s,ios,swift,amazon-web-services,email,amazon-ses,Ios,Swift,Amazon Web Services,Email,Amazon Ses,我在我的应用程序中使用amazon ses sdk从应用程序发送电子邮件。在android应用程序中,sdk将电子邮件发送到所有电子邮件地址,但在iOS应用程序中,我无法将电子邮件发送到Gmail电子邮件地址。我可以通过iOS应用程序将电子邮件发送到任何其他电子邮件服务,但它不适用于gmail id。我使用以下代码以原始格式发送电子邮件,因为我必须在电子邮件中以附件形式发送图像 let credentials = AWSStaticCredentialsProvider(accessKey: "

我在我的应用程序中使用amazon ses sdk从应用程序发送电子邮件。在android应用程序中,sdk将电子邮件发送到所有电子邮件地址,但在iOS应用程序中,我无法将电子邮件发送到Gmail电子邮件地址。我可以通过iOS应用程序将电子邮件发送到任何其他电子邮件服务,但它不适用于gmail id。我使用以下代码以原始格式发送电子邮件,因为我必须在电子邮件中以附件形式发送图像

let credentials = AWSStaticCredentialsProvider(accessKey: "XXXXX", secretKey: "XXXXX")
let configuration = AWSServiceConfiguration(region: .USEast1, credentialsProvider: credentials)
AWSServiceManager.default().defaultServiceConfiguration = configuration

let attachment = UIImageJPEGRepresentation(image, 0)
let attachmentString = attachment!.base64EncodedString(options: .lineLength64Characters)
let MIMEDataType = "image/jpeg"
let attachmentName = "screenshot1"

let attachment2 = UIImageJPEGRepresentation(image2, 0)
let attachmentString2 = attachment2!.base64EncodedString(options: .lineLength64Characters)
let attachmentName2 = "screenshot2"

let message:String = """
Subject: \(String)
MIME-Version: 1.0
Content-Type: multipart/mixed;
boundary="XXXXboundary text"

This is a multipart message in MIME format.

--XXXXboundary text
Content-Type: text/plain

\(data)

--XXXXboundary text
Content-Type: \(MIMEDataType);
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="\(attachmentName).\(MIMEDataType.components(separatedBy: "/")[1])"

\(attachmentString)

--XXXXboundary text
Content-Type: \(MIMEDataType);
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="\(attachmentName2).\(MIMEDataType.components(separatedBy: "/")[1])"

\(attachmentString2)

--XXXXboundary text--
"""

let data = message.data(using: .utf8)
let rawMessage = AWSSESRawMessage()
rawMessage?.data = data
let rawRequest = AWSSESSendRawEmailRequest()
rawRequest?.destinations = toEmail
rawRequest?.source = "xxxx@xxxx.com"

rawRequest?.rawMessage = rawMessage

AWSSES
  .default()
  .sendRawEmail(rawRequest!)
  .continueOnSuccessWith { (task) -> Any? in
       success(Strings.ResultSharedOnEmail)
   }
   .continueWith { (task) -> Any? in
       if task.error != nil {
          print("Error sending email")
          print(task.error?.localizedDescription ?? "")
          let type : String? = (task.error! as NSError).userInfo["Type"] as? String
          print("Type   : \(type ?? "")")

          let errorMessage : String? = (task.error! as NSError).userInfo["Message"] as? String
          print("Message: \(errorMessage ?? "")")

          var code : String? = (task.error! as NSError).userInfo["Code"] as? String
          code = (code != nil ? code : "Unknown")
          print("Code   : \(code ?? "")")
          failure(errorMessage ?? "")
        }
   return nil
}
谁能帮我一下吗。这样我就可以知道我的代码有问题,或者还有其他问题