ttek / tk-mail
A mail lib using PHPMailer for the tk libs
8.0.4
2024-09-09 00:00 UTC
Requires
- phpmailer/phpmailer: ~6.0
- ttek/tk-framework: ~8.0.0
- dev-master
- 8.0.x-dev
- 8.0.4
- 8.0.2
- 8.0.0
- 3.2.x-dev
- 3.2.22
- 3.2.20
- 3.2.18
- 3.2.16
- 3.2.14
- 3.2.12
- 3.2.10
- 3.2.8
- 3.2.6
- 3.2.4
- 3.2.2
- 3.2.0
- 3.0.x-dev
- 3.0.28
- 3.0.26
- 3.0.24
- 3.0.22
- 3.0.20
- 3.0.18
- 3.0.16
- 3.0.14
- 3.0.12
- 3.0.10
- 3.0.8
- 3.0.6
- 3.0.4
- 3.0.2
- 3.0.0
- 2.0.26
- 2.0.24
- 2.0.22
- 2.0.20
- 2.0.18
- 2.0.16
- 2.0.14
- 2.0.12
- 2.0.11
- 2.0.10
- 2.0.9
- 2.0.8
- 2.0.7
- 2.0.6
- 2.0.5
- 2.0.4
- 2.0.3
- 2.0.2
- 2.0.1
- 2.0.0
- dev-ver2
This package is auto-updated.
Last update: 2024-10-13 02:02:23 UTC
README
Project: tk-mail
Web: https://github.com/tropotek/tk-mail/
Authors: Michael Mifsud http://www.tropotek.com/
A mail lib for the Tk lib. Uses PHPMailer for the email driver.
Contents
Installation
Available on Packagist (ttek/tk-mail) and installable via Composer.
composer require ttek/tk-mail
Or add the following to your composer.json file:
"ttek/tk-mail": "~3.0"
Introduction
Basic Example:
$message = new \Tk\Mail\Message(); $message->addTo('info@tropotek.com'); $message->setFrom('godar@tropotek.com.au'); $message->setSubject('This is a test email'); $message->setBody(\App\Config::createMailTemplate('This is some message text')); $message->send();
Available Config Params:
/* Default config options */ $cfg = array(); /* * Options mail, smtp, sendmail, qmail */ $cfg['mail.driver'] = 'mail'; /* * SMTP settings */ /** * SMTP hosts. * Either a single hostname or multiple semicolon-delimited hostnames. * You can also specify a different port * for each host by using this format: [hostname:port] * (e.g. "smtp1.example.com:25;smtp2.example.com"). * You can also specify encryption type, for example: * (e.g. "tls://smtp1.example.com:587;ssl://smtp2.example.com:465"). * Hosts will be tried in order. * @var string */ $cfg['mail.smtp.host'] = 'localhost'; // The default SMTP server port. $cfg['mail.smtp.port'] = 25; $cfg['mail.smtp.username'] = ''; $cfg['mail.smtp.password'] = ''; // What kind of encryption to use on the SMTP connection. Options: '', 'ssl' or 'tls' $cfg['mail.smtp.secure'] = ''; // Whether to use SMTP authentication. Uses the Username and Password properties. $cfg['mail.smtp.enableAuth'] = true; // Whether to keep SMTP connection open after each message. If this is set to true // then to close the connection requires an explicit call to smtpClose(). $cfg['mail.smtp.enableKeepAlive'] = ''; // Checks if the send command was called from this site $cfg['mail.checkReferer'] = true; // Add valid domain names as valid referers if needed $cfg['mail.validReferers'] = ''; /* * Other misc options * Generally from the site config */ // Set this if you want all email to go to this address during debug //$cfg['system.debug.email'] = 'debug@'.$_SERVER['HTTP_HOST']; // \Tk\Request Used to set the X-Sender-IP, X-Referer headers //$cfg['request'] = ''; // \Tk\Session Used to set the X-SiteReferer header //$cfg['session'] = ''; // If true then all outgoing messages are sent to the `system.debug.email` address //$cfg['debug'] = false; // If set X-Application will be set to this //$cfg['system.name'] = ''; //$cfg['system.version'] = ''; // Change this to suite your message body encoding //$cfg['mail.encoding'] = 'UTF-8';