title: Use a Node Lambda function to parse an email stored in an AWS S3 Bucket by SES
body: <p><strong>Here's the section of the Node Lambda function that gets the email stored in S3. How do I just get the 'text/plain' content from the returned data object?</strong></p>
  
  <p>Do I need to include an NPM email parsing dependency with the lambda function (uploaded as .zip) or should I use some regex in the lambda to get the section I want? If so what would that look like?</p>
  
  <pre><code>exports.handler = function(event, context, callback) {
  
      var sesNotification = event.Records[0].ses;
  
      // Retrieve the email from your bucket
      s3.getObject({
          Bucket: bucketName,
          Key: "ses/"+sesNotification.mail.messageId
      }, function(err, data) {
          if (err) {
              console.log(err, err.stack);
              callback(err);
          } else {
  
              data
  
          }
      });
  
  };
  </code></pre>