Update email.php
[clinton/MarylandElectronicPetitionSignature.git] / email.php
CommitLineData
5c66ac11 1<?PHP
46790afe 2// Pear Mail Library
5c66ac11
PM
3require_once "Mail.php";
4include_once('/var/www/secure.php');
5c66ac11 5global $gmail_email_user;
5c66ac11 6global $gmail_email_pass;
5c66ac11 7
f202cc64 8$from = 'Patrick McGuire <mdpetition@gmail.com>';
46790afe
PM
9$to = '<insidenothing@gmail.com>';
10$subject = 'Hi!';
11$body = "Hi,\n\nHow <b>are</b> you?";
12
13$headers = array(
14 'From' => $from,
15 'To' => $to,
16 'Subject' => $subject
17);
18
19$smtp = Mail::factory('smtp', array(
20 'host' => 'ssl://smtp.gmail.com',
21 'port' => '465',
22 'auth' => true,
23 'username' => $gmail_email_user,
24 'password' => $gmail_email_pass
25 ));
5c66ac11
PM
26
27$mail = $smtp->send($to, $headers, $body);
28
29if (PEAR::isError($mail)) {
46790afe
PM
30 echo('<p>' . $mail->getMessage() . '</p>');
31} else {
32 echo('<p>Message successfully sent!</p>');
33}