How to send email from zend framework3?
define('MR_MAIL_HOST','smtp.sendgrid.net');
define('MR_MAIL_PORT','587');//457,25
define('MR_MAIL_USERNAME','username');
define('MR_MAIL_PASSWORD','password');
$transport = new Mail\Transport\Smtp();
$options = new Mail\Transport\SmtpOptions(array(
'name' => 'emailName',
'host' => MR_MAIL_HOST,
'connection_class' => 'login',
'connection_config' => array(
'username' => (MR_MAIL_USERNAME),
'password' => (MR_MAIL_PASSWORD),
'port' => MR_MAIL_PORT,
),
));
$transport->setOptions($options);
$mail = new Mail\Message();
$mail->setFrom('from@web-technology-experts-notes.in');
$mail->setSubject('This is simple subject');
$mail->setBody('this is html body text');
$mail->addTo('to@web-technology-experts-notes.in');
$transport->send($mail);