ZEND send with SMTP authentication

ZEND send with SMTP authentication
$mail = new \Zend_Mail('utf-8');
$mail->setFrom("XXX@XXX.com");
$mail->addTo($adminMail);
$mail->setSubject('My Subject');
$mail->setBodyHtml('email content');
$content = file_get_contents($filePath);
$attachment = new \Zend_Mime_Part($content);
$attachment->type = 'image/png'; // attachment's mime type
$attachment->disposition = \Zend_Mime::DISPOSITION_ATTACHMENT;
$attachment->encoding = \Zend_Mime::ENCODING_BASE64;
$attachment->filename = 'image_' . $customerId . '.png';
$mail->addAttachment($attachment);

// create mail transport
$transport = new \Zend_Mail_Transport_Smtp(
    'smtp.yourserver.com',
    [
        'auth' => 'login',
        'port' => 'yoursmtpport',
        'username' => 'yourusername',
        'password' => 'yourpassword',
    ]
);

$mail->send($transport);