PHP code example of programster / phpmailer-wrapper
1. Go to this page and download the library: Download programster/phpmailer-wrapper 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/ */
programster / phpmailer-wrapper example snippets
use Programster\Phpmailer\Attachment;
use Programster\Phpmailer\AttachmentCollection;
use Programster\Phpmailer\Contact;
use Programster\Phpmailer\ContactCollection;
use Programster\Phpmailer\PhpMailerEmailer;
use Programster\Phpmailer\SecurityProtocol;
from: new \Programster\Phpmailer\Contact('[email protected]', 'My Name'),
smtpPort: 587
);
# Send an email
$mailer->send(
subject: 'Latest Invoice',
plaintextMessage: "Please find attached my latest invoice.",
htmlMessage: "<p>Please find attached my latest invoice.</p>",
to: new ContactCollection(new Contact("[email protected]", "Client Name")),
cc: new ContactCollection(new Contact("[email protected]", "Accounts")),
attachments: new AttachmentCollection(new Attachment(__DIR__ . '/invoice.pdf', "my-invoice.pdf"));
);
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.