-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsendmail.php
More file actions
executable file
·30 lines (21 loc) · 984 Bytes
/
sendmail.php
File metadata and controls
executable file
·30 lines (21 loc) · 984 Bytes
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
29
30
<?php
// Send Email Using SMTP Authentication
if ($_POST['name'] && $_POST['email'] && $_POST['subject'] && $_POST['message']) {
require_once "Mail.php";
$from = $_POST['name'] . ' <' . $_POST['email'] . '>';
$to = 'siddhartharun@verizon.net'; // Insert the Recipient Email here
$subject = $_POST['subject'];
$body = $_POST['message'];
$host = 'smtp.gmail.com'; // Insert the Email Host here
$username = 'impactlab1@gmail.com'; // Insert the SMTP Username here
$password = 'keshavan2015'; // Insert the SMTP Password here
$headers = array( 'From' => $from, 'To' => $to, 'Subject' => $subject );
$smtp = Mail::factory( 'smtp', array( 'host' => $host, 'auth' => true, 'username' => $username, 'password' => $password ) );
$mail = $smtp->send($to, $headers, $body);
if (PEAR::isError($mail)) {
header('HTTP/1.1 500 Internal Server Error');
} else {
header('HTTP/1.1 200 OK');
}
}
?>