1. Go to this page and download the library: Download anekdotes/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/ */
anekdotes / mailer example snippets
use Anekdotes\Mailer\Mailer;
use Anekdotes\Mailer\Adapters\SendgridAdapter;
use Sendgrid\Sendgrid;
$mailer = new Mailer(new SendgridAdapter(new SendGrid('sendgridapikey')));
$mailer->send('<p>My HTML message</p>',function($message){
$message->from('[email protected]','Me')
->to('[email protected]','You')
->subject('This is a message');
});
use Anekdotes\Mailer\Adapters\SendgridAdapter;
$sendgrid = new SendgridAdapter(new SendGrid('sendgridapikey'));
$sendgrid->send('<p>My HTML message</p>',function($message){
$message->from('[email protected]','Me')
->to('[email protected]','You')
->subject('This is a message');
});
use Anekdotes\Mailer\Mailer;
use Anekdotes\Mailer\Adapters\SendgridAdapter;
use Sendgrid\Sendgrid;
$mailer = new Mailer(new SendgridAdapter(new SendGrid('sendgridapikey')));
$mailer->send('<p>My HTML message</p>',function($message){
$message->from('[email protected]','Me')
->to('[email protected]','You')
->subject('This is a message');
});
use Anekdotes\Mailer\Mailer;
use Anekdotes\Mailer\Adapters\Symfony\SymfonyAdapter;
use Symfony\Component\Mailer\Mailer as SymfonyMailer;
use Symfony\Component\Mailer\Transport as SymfonyTransport;
$dsn = 'smtp://user:[email protected]:25';
$symfonyTransport = SymfonyTransport::fromDsn($dsn);
$symfonyMailer = new SymfonyMailer($symfonyTransport);
$mailer = new Mailer(new SymfonyAdapter($symfonyMailer));
$mailer->send('<p>My HTML message</p>',function($message){
$message->from('[email protected]','Me')
->to('[email protected]','You')
->subject('This is a message');
});
use Anekdotes\Mailer\Mailer;
use Anekdotes\Mailer\Adapters\SwiftMailerAdapter;
use \Swift_Mailer;
use \Swift_SmtpTransport;
$mailer = new Mailer(new SwiftMailerAdapter(new Swift_Mailer(Swift_SmtpTransport::newInstance('smtp.example.org', 25)
->setUsername('your username')
->setPassword('your password'))));
$mailer->send('<p>My HTML message</p>',function($message){
$message->from('[email protected]','Me')
->to('[email protected]','You')
->subject('This is a message');
});
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.