-
-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathexample.php
More file actions
21 lines (15 loc) · 606 Bytes
/
example.php
File metadata and controls
21 lines (15 loc) · 606 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
<?php
use ByJG\Mail\MailerFactory;
use ByJG\Mail\Wrapper\PHPMailerWrapper;
require "vendor/autoload.php";
// Create a connection URL (see below)
MailerFactory::registerMailer(PHPMailerWrapper::class);
$mailer = \ByJG\Mail\MailerFactory::create('protocol://username:password/smtpserver:port');
// Create the email envelope
$envelope = new ByJG\Mail\Envelope();
$envelope->setFrom('johndoe@example.com', 'John Doe');
$envelope->addTo('jane@example.com');
$envelope->setSubject('Email Subject');
$envelope->setBody('html text body');
// The the email with the selected mailer.
$mailer->send($envelope);