1. Go to this page and download the library: Download twindots/email-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/ */
twindots / email-service example snippets
use EmailShortCodes;
public function compileCodes( EmailShortCodes $shortcodes )
{
// Or create a new instance
// $shortcodes = new EmailShortCodes();
$compiled = $shortcodes->objects([
'user' => $user,
])
->withUser()
->body( request('body') )
->compile();
}
use EmailService;
public function sendEmail( EmailService $emailService )
{
// Or create a new instance
// $emailService = new EmailService();
$result = $emailService->email(['[email protected]', '[email protected]'])
->subject( $subject )
->body( $compiled ) // Send the compiled body or any html
->attach([
'file-1.png' => 'path/to/file-1.png',
'file-2.pdf' => 'path/to/file-2.png'
])
->send();
}