1. Go to this page and download the library: Download trejjam/emailing 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/ */
trejjam / emailing example snippets
/**
* @var \Trejjam\Emailing\RabbitMq\Mailer @inject
*/
public $rabbitMailer;
/**
* @var \Trejjam\Emailing\Emails @inject
*/
public $emails;
/**
* @var \Trejjam\Emailing\Groups @inject
*/
public $groups;
/**
* @var \Trejjam\Emailing\Senders @inject
*/
public $senders;
function renderDefault() {
$this->senders->addSender("[email protected]");
$this->senders->addSender("[email protected]", "other");
$message=$this->rabbitMailer->createEmail();
$message->setSender("[email protected]"); //set from and connection
$message->setImapSave(TRUE);
$message->setTo("[email protected]");
$this->rabbitMailer->send($message);
//send email generated by defaultTemplate, send using default connection, save email to IMAP
$message->setSender("[email protected]");
$message->setTemplate("newsletter.latte");
$message->setImapFolder("Sent.newsletter");
$message->setImapConnection("default");
$message->setUnsubscribeEmail("[email protected]");
$message->setTo("[email protected]");
$this->rabbitMailer->send($message);
//send email generated by newsletter.latte, send using 'other' connection, save email to IMAP using 'default'
$email = $this->emails->addEmail("[email protected]");
$email2 = $this->emails->addEmail("[email protected]");
$all=$this->groups->addGroup("all");
$group = $this->groups->addGroup("newsletter", "all");
$this->emails->addEmailToGroup($email, $group);
$this->emails->addEmailToGroup($email2, $all);
foreach ($all->getEmailsRecursive() as $v) {
dump($v->getEmail()); //[email protected], [email protected]
}
foreach ($all->getEmails() as $v) {
dump($v->getEmail()); //[email protected]
}
foreach ($group->getEmails() as $v) {
dump($v->getEmail()); //[email protected]
}
dump($this->groups->getGroup("all")->containEmail($email)); //FALSE
dump($this->groups->getGroup("newsletter")->containEmail($email)); //TRUE
$this->emails->removeEmail("[email protected]", TRUE);
$this->emails->removeEmail("[email protected]", TRUE);
}
sh
php index.php
sh
php index.php Emailing:install
sh
php index.php Emailing:imap [connectionName=default] -l
sh
php index.php Emailing:groups groupName [parentName] -m [-l]
sh
php index.php Emailing:groups groupName -t type [-l]
sh
php index.php Emailing:groups groupName -r [-l]
sh
php index.php Emailing:groups -l
sh
php index.php Emailing:senders senderEmail [connection=default] -c [-l]
sh
php index.php Emailing:senders senderEmail [connection=default] [-l]
sh
php index.php Emailing:senders senderEmail -r [-l]
sh
php index.php Emailing:senders -l
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.