PHP code example of systream / mail-service
1. Go to this page and download the library: Download systream/mail-service 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/ */
systream / mail-service example snippets
$item = Mail\MailQueueItem\MailQueueItemFactory::make('subject', 'Message for {$name}', '[email protected] ', 'Recipent Name', array('name' => 'John'));
$tokenFormatter = new TokenFormatter($tokens);
// ...
$mailQueueItem = new MailQueueItem($message);
$mailQueueItem->addMessageFormatter($tokenFormatter);
$mailTemplate = new StringMailTemplate($body, $subject);
$message = new Message($mailTemplate);
$message->addRecipient(new Recipient($recipientEmail, $recipientName));
$tokenFormatter = new TokenFormatter($tokens);
$mailTemplate = new StringMailTemplate($body, $subject);
$message = new Message($mailTemplate);
$message->addRecipient(new Recipient($recipientEmail, $recipientName));
$mailQueueItem = new MailQueueItem($message);
$mailQueueItem->addMessageFormatter($tokenFormatter);
$PHPMailer = new \PHPMailer(true);
$PHPMailer->isSMTP();
$PHPMailer->Host = "127.0.0.1";
$PHPMailer->Port = 1025;
$PHPMailer->SetFrom('[email protected] ');
$mailer = new Mail\MailSender\PHPMailerAdapter($PHPMailer);
$mail = new Mail($mailer, new Mail\QueueHandler\SqliteQueHandlerAdapter());
$mail->send($item);
$mail->queue($item);
$mail->consume();
$mail->setLogger($logger);