简体   繁体   中英

Aws::SES::Errors::InvalidParameterValue: Nested group ruby send_raw_email with attachments

When i used documentation from aws ses for ruby say: https://www.rubydoc.info/gems/aws-sdk-ses/1.14.0/Aws%2FSES%2FClient:send_raw_email

I try that code and give me that errro: Aws::SES::Errors::InvalidParameterValue: Nested group

I try to send email using send_raw_email but using documentation from AWS SES for ruby when i test that code in documentation the program return: Aws::SES::Errors::InvalidParameterValue: Nested group and not send email

This is a problem with interpolation, im resolve this using this:

# open and read archive to send in attachment
file = File.open(path_from_csv_created).read

resp = ses_client.send_raw_email(
      source: 'email_send',
      destinations: ['email_to_receive'],
      raw_message: {
        data: <<~MESSAGE
          From: email_send
          To: email_to_receive
          Subject: Test email (contains an attachment)
          MIME-Version: 1.0
          Content-type: Multipart/Mixed; boundary="NextPart"

          --NextPart
          Content-Type: text/plain

          bodyyyy

          --NextPart
          Content-Type: application/csv;
          Content-Disposition: attachment; filename="#{file_csv_name}"

          #{file}
        MESSAGE
      }
    )

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM