PHP code example of schema31 / php-ci-mailer

1. Go to this page and download the library: Download schema31/php-ci-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/ */

    

schema31 / php-ci-mailer example snippets


$config = [];
$config['protocol'] = 'smtp';// mail, sendmail, smtp
$config['smtp_host'] = 'smtp_host';// SMTP Server Address.
$config['smtp_user'] = 'smtp_user';// SMTP Username.
$config['smtp_pass'] = 'smtp_pass';// SMTP Password.
$config['smtp_port'] = '25';// SMTP Port.
$config['mailtype'] = 'html';// text or html
$config['smtp_timeout'] = '30';// SMTP Timeout (in seconds).
$config['from_email'] = '[email protected]';
$config['from_name'] = 'CI MAILER';
$config['prefix_subject'] = 'Mailer - ';

$mailer = new \Schema31\CiMailer\Mailer($config);

$mailer = new \Schema31\CiMailer\Mailer();

$mailer = new \Schema31\CiMailer\Mailer();

$mailer->setSingleTo("[email protected]"); //Single "to" recipient
$mailer->setSingleCc("[email protected]"); //Single "cc" recipient
$mailer->setSingleBcc("[email protected]"); //Single "bcc" recipient

$mailer = new \Schema31\CiMailer\Mailer();

$mailer->setMultipleTo(["[email protected]", "[email protected]"]); //Multiple "to" recipient: "[email protected]" and "[email protected]"
$mailer->setMultipleCc(["[email protected]", "[email protected]"]); //Multiple "cc" recipient: "[email protected]" and "[email protected]"
$mailer->setMultipleBcc(["[email protected]", "[email protected]"]); //Multiple "bcc" recipient: "[email protected]" and "[email protected]"

$mailer = new \Schema31\CiMailer\Mailer();

$mailer->setSingleTo("[email protected],[email protected]"); //Multiple "to" recipient: "[email protected]" and "[email protected]" comma separated
$mailer->setSingleCc("[email protected],[email protected]"); //Multiple "cc" recipient: "[email protected]" and "[email protected]" comma separated
$mailer->setSingleBcc("[email protected],[email protected]"); //Multiple "bcc" recipient: "[email protected]" and "[email protected]" comma separated

$mailer = new \Schema31\CiMailer\Mailer();

//...

echo $mailer->printDebugger();

$mailer = new \Schema31\CiMailer\Mailer();

//Method chaining is allowed
$mailer
->setSingleTo("[email protected]")
->setSubject("Email di prova #" . uniqid())
->setMessage("La email di testo")
->send(); //returns true if the email is sent, false otherwise.