PHP code example of webservco / mail

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

    

webservco / mail example snippets


use WebServCo\Mail\DataTransfer\MailItem;
use WebServCo\Mail\Service\MailingTableNameServiceFromConfig;
use WebServCo\Mail\Service\Storage\MailItemStorage;

// \WebServCo\Mail\Contract\Service\MailingTableNameServiceInterface
$tableNameService = new MailingTableNameServiceFromConfig($configurationGetter);
// \WebServCo\Mail\Contract\Service\Storage\MailItemStorageInterface
$mailItemStorage = new MailItemStorage($tableNameService, $pdoContainer);

$mailItemId = $mailItemStorage->storeMailItem(
    // subject, HTML message, to, cc, bcc
    new MailItem('Your order', '<p>Thank you.</p>', '[email protected]', null, '[email protected]'),
);

// \WebServCo\Mail\Contract\Factory\MailingProcessorFactoryInterface (your factory)
$mailingProcessor = $mailingProcessorFactory->createMailingProcessor($tableNameService);
$mailingProcessor->process();

// \WebServCo\Command\Contract\ItemsProcessingReportInterface
$report = $mailingProcessor->getItemsProcessingReport();
$output->write(sprintf('Sent %d of %d.', $report->getTotalProcessed(), $report->getTotalItems()));