PHP code example of quartzy / php-email
1. Go to this page and download the library: Download quartzy/php-email 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/ */
quartzy / php-email example snippets
use PhpEmail\Attachment\FileAttachment;
use PhpEmail\EmailBuilder;
use PhpEmail\Content\SimpleContent;
$email = EmailBuilder::email()
->withSubject('Welcome!')
->withContent(SimpleContent::text('Start your free trial now!!!'))
->from('[email protected]')
->to('[email protected]')
->cc('[email protected]')
->bcc('[email protected]')
->replyTo('[email protected]')
->attach(new FileAttachment('/path/to/my/file.txt'))
->build();
use PhpEmail\EmailBuilder;
use PhpEmail\Content\TemplatedContent;
$content = new TemplatedContent('my_templates_id', ['firstName' => 'Billy']);
$email = EmailBuilder::email()
->withSubject('Welcome!')
->withContent($content)
->from('[email protected]')
->to('[email protected]')
->build();
bash
composer