PHP code example of ikkez / f3-mailer

1. Go to this page and download the library: Download ikkez/f3-mailer 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/ */

    

ikkez / f3-mailer example snippets


function send_test($email, $title=null) {
	$mail = new \Mailer();
	$mail->addTo($email, $title);
	$mail->setText('This is a Test.');
	$mail->setHTML('This is a <b>Test</b>.');
	$mail->send('Test Mail Subject');
}

$mail = new \Mailer('UTF-8'); // default
$mail = new \Mailer('ISO-8859-1');
$mail = new \Mailer('ISO-8859-15');

$f3->config('mailer_config.ini');
// ...
Mailer::initTracking();
// ...
$f3->run();

static public function logError($mailer, $log) {
	$logger = new \Log('logs/smtp_'.date('Y_m_d').'.log');
	$logger->write($log);
}

static public function traceMail($hash) {
	// your mail $hash is being read
}

static public function traceClick($target) {
	// someone clicked $target link
}

$mail->send($subject, TRUE); // mock call 
$mail->save('newsletter.eml'); // save to file in 'mailer.storage_path' directory
$mail->reset();

$success = $mailer->send($subject);
$f3->write('SMTP_mail.log', $this->mailer->log());

$mailer->send($subject, $mock, $log);