PHP code example of mtymek / mt-mail
1. Go to this page and download the library: Download mtymek/mt-mail library . Choose the download type require .
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
mtymek / mt-mail example snippets
$mailService = $this->getServiceLocator()->get(\MtMail\Service\Mail::class);
$headers = [
'to' => '[email protected] ',
'from' => '[email protected] ',
];
$variables = [
'userName' => 'John Doe',
];
$message = $mailService->compose($headers, 'application/mail/welcome.phtml', $variables);
return [
'mt_mail' => [
'composer_plugins' => [
'Layout',
],
'layout' => 'application/mail/layout.phtml',
],
];
return [
'mt_mail' => [
'transport' => \Zend\Mail\Transport\Smtp::class,
'transport_options' => [
'host' => 'some-host.com',
'connection_class' => 'login',
'connection_config' => [
'username' => 'user',
'password' => 'pass',
'ssl' => 'tls',
],
],
],
];
// create and configure message
$message = new Message();
$message->addTo('[email protected] ');
// ...
// send!
$mailService = $this->getServiceLocator()->get(\MtMail\Service\Mail::class);
$mailService->send($message);