PHP code example of copernica / smtpeter-php
1. Go to this page and download the library: Download copernica/smtpeter-php 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/ */
copernica / smtpeter-php example snippets
/**
* REST API token that can be obtained from SMTPeter website.
*/
$apiToken = '';
// create new instance of email message
$email = new SMTPeter\Email($apiToken);
// set the email
$email->setFrom('Paweł Kuźnik <[email protected]>');
$email->setSubject('SMTPeter test email');
$email->setText('text version');
$email->setHtml('<html><body><h1>HTML version</h1></body></html>');
// composer array of TO addresses and CC addresses
$to = array('[email protected]');
$cc = array('[email protected]');
// set to and cc
$email->setTo($to);
$email->setCC($cc);
// append recipients
$email->appendRecipients($to);
$email->appendRecipients($cc);
// send the email
$email->send();
composer