1. Go to this page and download the library: Download mabasic/mailer 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/ */
namespace Acme\Mailers;
use Mabasic\Mailer\Mailer;
class ContactMailer extends Mailer {
public function send($data)
{
$view = 'emails.contact';
$subject = 'Test';
$email = '[email protected]';
$this->sendTo($email, $subject, $view, $data);
}
}
use Acme\Mailers\ContactMailer;
class MailerController extends \BaseController {
protected $contactMailer;
function __construct(ContactMailer $contactMailer)
{
$this->contactMailer = $contactMailer;
}
public function sendMail()
{
// Get some data for the email, like user name, message, etc ...
$data = [
'name' => 'John Doe',
'comment' => 'Hello, nice to meet you.'
];
$this->contactMailer->send($data);
return 'ok';
}
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.