forked from eoghanobrien/php-simple-mail
-
Notifications
You must be signed in to change notification settings - Fork 0
/
example.php
28 lines (23 loc) · 833 Bytes
/
example.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
<?php
require 'class.simple_mail.php';
echo '<h1>Simple Mail</h1>';
$mailer = new Simple_Mail();
$send = $mailer->setTo('test@gmail.com', 'Recipient 1')
->setTo('test2@gmail.com', 'Recipient 2')
->setSubject('Test Message')
->setFrom('sender@gmail.com', 'Sender')
->addMailHeader('Reply-To', 'sender@gmail.com', 'Sender')
->addMailHeader('Cc', 'bill@example.com', 'Bill Gates')
->addMailHeader('Bcc', 'steve@example.com', 'Steve Jobs')
->addGenericHeader('X-Mailer', 'PHP/' . phpversion())
->addGenericHeader('Content-Type', 'text/html; charset="utf-8"')
->setMessage('<strong>This is a test message.</strong>')
->setWrap(78)
->send();
echo $mailer->debug();
if ($send) {
echo 'Email was sent successfully!';
}
else {
echo 'An error occurred. We could not send email';
}