protected function setSmtpApi(&$data, Swift_Mime_SimpleMessage $message)
    {
        foreach ($message->getChildren() as $attachment) {
            if (!$attachment instanceof Swift_Image
                || !in_array(self::SMTP_API_NAME, [$attachment->getFilename(), $attachment->getContentType()])
            ) {
                continue;
            }
            $data['x-smtpapi'] = json_encode($attachment->getBody());
        }
    }
protected function setSmtpApi(&$data, Swift_Mime_SimpleMessage $message)
    {
        foreach ($message->getChildren() as $attachment) {
            if (!$attachment instanceof Swift_Image
                || !in_array(self::SMTP_API_NAME, [$attachment->getFilename(), $attachment->getContentType()])
            ) {
                continue;
            }
            $data['x-smtpapi'] = json_encode($attachment->getBody());
        }
    }
protected function setSmtpApi ( & $ data , Swift_Mime_SimpleMessage $ message ) { foreach ( $ message -> getChildren ( ) as $ attachment ) { if ( ! $ attachment instanceof Swift_Image || ! in_array ( self :: SMTP_API_NAME , [ $ attachment -> getFilename ( ) , $ attachment -> getContentType ( ) ] ) ) { continue ; } $ data [ 'x-smtpapi' ] = json_encode ( $ attachment -> getBody ( ) ) ; } }
Set Sendgrid SMTP API

@param $data
@param Swift_Mime_SimpleMessage $message
Set Sendgrid SMTP API