1. Go to this page and download the library: Download simplon/email 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/ */
simplon / email example snippets
// php's internal mail
$emailTransportVo = (new \Simplon\Email\Vo\EmailTransportVo())->setTransportInstance(
\Swift_MailTransport::newInstance()
);
// or via smtp transport
$emailTransportVo = (new \Simplon\Email\Vo\EmailTransportVo())->setTransportInstance(
\Swift_SmtpTransport::newInstance('localhost', 25)
->setUsername('foo')
->setPassword('bar')
);
// set content data
$contentData = [
'name' => 'Tino',
'age' => 32,
'date' => date('r'),
];
$response = (new \Simplon\Email\Email($emailTransportVo))->sendEmail($emailVo);
// load test data
###########################
// set content data
$contentData = [
'name' => 'Tino',
'age' => 32,
'date' => date('r'),
];
// set email
$emailVo = (new \Simplon\Email\Vo\EmailVo())
->setPathBaseTemplates(__DIR__ . '/templates/base')
->setPathContentTemplates(__DIR__ . '/templates/content/tmpl01')
->setFrom($config['fromAddress'], $config['fromName'])
->setTo($config['toAddress'], $config['toName'])
->setSubject('Herro!')
->setContentData($contentData);
// ------------------------------------------
// set transport
$emailTransportVo = new \Simplon\Email\Vo\EmailTransportVo(
\Swift_MailTransport::newInstance()
);
// ------------------------------------------
// send email
$response = (new \Simplon\Email\Email($emailTransportVo))->sendEmail($emailVo);
// BOOL to indicate if all went fine
var_dump($response);
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.