Пример #1
0
    exit;
}
// choose what mailer type do you want to use (null,phpmailer,phpnative)
$mailertype = 'null';
// it is really used only if  $mailertype is 'phpmailer'
$maileroptions = array('logger' => $logger1, 'format' => array('locale' => '', 'deflocale' => 'en', 'templateprocessorclass' => null, 'templatecompiledir' => $thisdir . '/email_tmp/', 'templatespath' => $thisdir . '/email_intern_templates/'), 'mailsystem' => 'smtp', 'smtp_host' => 'smtp_host', 'smtp_port' => 25, 'smtp_secure' => false, 'smtp_auth' => true, 'smtp_user' => 'smtp user', 'smtp_password' => 'smtp password');
// make email sending object
switch ($mailertype) {
    case 'phpmailer':
        $mailer = new \Gelembjuk\Mail\PHPMailer();
        break;
    case 'phpnative':
        $mailer = new \Gelembjuk\Mail\PHPNative();
        break;
    default:
        $mailer = new \Gelembjuk\Mail\NullMail();
        // check if log file is writable as
}
// init email processor
$mailer->initMailer($maileroptions);
// ===================== TEST SECTION =================================
$contactdata = array('name' => 'John Smith', 'message' => 'This is my contact message');
// SEND CONTACT EMAIL in default locale (en)
$mailer->formatAndSendEmail('contact', $contactdata, '*****@*****.**', '*****@*****.**');
// now set `de` locale and send again German copy of email
$mailer->setFormatterOption('locale', 'de');
// send same email but now templates must be from different locale
$mailer->formatAndSendEmail('contact', $contactdata, '*****@*****.**', '*****@*****.**');
// now set `fr` locale and send again French copy of email
$mailer->setFormatterOption('locale', 'fr');
// send same email but now templates must be from different locale
Пример #2
0
    exit;
}
// choose what mailer type do you want to use (null,phpmailer,phpnative)
$mailertype = 'null';
// it is really used only if  $mailertype is 'phpmailer'
$maileroptions = array('logger' => $logger1, 'format' => array('locale' => '', 'deflocale' => 'en', 'templateprocessorclass' => null, 'templatecompiledir' => $thisdir . '/email_tmp/', 'templatespath' => $thisdir . '/email_templates/'), 'mailsystem' => 'smtp', 'smtp_host' => 'smtp_host', 'smtp_port' => 25, 'smtp_secure' => false, 'smtp_auth' => true, 'smtp_user' => 'smtp user', 'smtp_password' => 'smtp password');
// make email sending object
switch ($mailertype) {
    case 'phpmailer':
        $mailer = new \Gelembjuk\Mail\PHPMailer();
        break;
    case 'phpnative':
        $mailer = new \Gelembjuk\Mail\PHPNative();
        break;
    default:
        $mailer = new \Gelembjuk\Mail\NullMail();
        // check if log file is writable as
}
// init email processor
$mailer->initMailer($maileroptions);
// ===================== TEST SECTION =================================
// SEND CONTACT EMAIL
$contactdata = array('name' => 'John Smith', 'message' => 'This is my contact message');
$mailer->formatAndSendEmail('contact', $contactdata, '*****@*****.**', '*****@*****.**');
// SEND ACTIVATION EMAIL
$data = array('user' => 'User name', 'activationlink' => 'http://fakesite.com/activate/code');
$mailer->formatAndSendEmail('activate', $data, '*****@*****.**', '*****@*****.**', '', '', '', 'custom');
echo 'Both emails were sent. ';
if ($mailertype == 'null') {
    echo 'Check log file to see results';
}