/** * Example. Usage of Gelembjuk/Mail . Send simple contact email. * The example shows how to easy create wel formatted emails and send them to users * The package allows to change sending engine easy without many changes in your PHP code. * Different mail systems have same interface, change only mailer clas name. * * This example is part of gelembjuk/templating package by Roman Gelembjuk (@gelembjuk) */ // ===================== INIT SECTION ================================= // path to your composer autoloader require 'vendor/autoload.php'; $thisdir = dirname(__FILE__) . '/'; // create logger object $logger1 = new Gelembjuk\Logger\FileLogger(array('logfile' => $thisdir . '/logs/log.txt', 'groupfilter' => 'all')); if (!$logger1->logFileIsWritable()) { echo '<font color="red">No access to write to log file </font>'; 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;