Skip to content

Commit ced9837

Browse files
committed
Liamg.ca initial
1 parent c795bc5 commit ced9837

File tree

422 files changed

+137035
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

422 files changed

+137035
-0
lines changed

.gitignore

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# project
2+
_site
3+
.sass-cache
4+
.vagrant
5+
6+
# general
7+
.DS_Store
8+
Thumbs.db
9+
ehthumbs.db

_lib/mail.php

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
<?php
2+
3+
require '../_lib/phpmailer/PHPMailerAutoload.php';
4+
5+
// CONFIG YOUR FIELDS
6+
//============================================================
7+
$name = filter_var($_POST["name"], FILTER_SANITIZE_STRING);
8+
$email = filter_var($_POST["email"], FILTER_SANITIZE_EMAIL);
9+
$formMessage = filter_var($_POST["message"], FILTER_SANITIZE_STRING);
10+
11+
// CONFIG YOUR EMAIL MESSAGE
12+
//============================================================
13+
$message = '<p>The following request was sent from: </p>';
14+
$message .= '<p>Name: ' . $name . '</p>';
15+
$message .= '<p>Email: ' . $email . '</p>';
16+
$message .= '<p>Message: ' . $formMessage .'</p>';
17+
18+
// CONFIG YOUR MAIL SERVER
19+
//============================================================
20+
$mail = new PHPMailer;
21+
$mail->isSMTP(); // Enable SMTP authentication
22+
$mail->SMTPAuth = true; // Set mailer to use SMTP
23+
$mail->Host = 'smtp.gmail.com'; // Specify main and backup server (this is a fake name for the use of this example)
24+
25+
$mail->Username = '[email protected]'; // SMTP username
26+
$mail->Password = ''; // SMTP password
27+
$mail->SMTPSecure = 'tls'; // Enable encryption, 'ssl' also accepted
28+
$mail->Port = 587;
29+
30+
$mail->From = $email;
31+
$mail->FromName = $name;
32+
$mail->AddReplyTo($email,$name);
33+
$mail->addAddress('[email protected]', $name); // Add a recipient
34+
35+
$mail->WordWrap = 50; // Set word wrap to 50 characters
36+
$mail->isHTML(true); // Set email format to HTML
37+
38+
$mail->Subject = 'Contact request';
39+
$mail->Body = $message;
40+
$mail->AltBody = 'This is the body in plain text for non-HTML mail clients';
41+
42+
if(!$mail->send()) {
43+
$data['error']['title'] = 'Message could not be sent.';
44+
$data['error']['details'] = 'Mailer Error: ' . $mail->ErrorInfo;
45+
exit;
46+
}
47+
48+
$data['success']['title'] = 'Message has been sent';
49+
50+
echo json_encode($data);
51+
?>

_lib/phpmailer/PHPMailerAutoload.php

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
<?php
2+
/**
3+
* PHPMailer SPL autoloader.
4+
* PHP Version 5
5+
* @package PHPMailer
6+
* @link https://github.com/PHPMailer/PHPMailer/ The PHPMailer GitHub project
7+
* @author Marcus Bointon (Synchro/coolbru) <[email protected]>
8+
* @author Jim Jagielski (jimjag) <[email protected]>
9+
* @author Andy Prevost (codeworxtech) <[email protected]>
10+
* @author Brent R. Matzelle (original founder)
11+
* @copyright 2012 - 2014 Marcus Bointon
12+
* @copyright 2010 - 2012 Jim Jagielski
13+
* @copyright 2004 - 2009 Andy Prevost
14+
* @license http://www.gnu.org/copyleft/lesser.html GNU Lesser General Public License
15+
* @note This program is distributed in the hope that it will be useful - WITHOUT
16+
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
17+
* FITNESS FOR A PARTICULAR PURPOSE.
18+
*/
19+
20+
/**
21+
* PHPMailer SPL autoloader.
22+
* @param string $classname The name of the class to load
23+
*/
24+
function PHPMailerAutoload($classname)
25+
{
26+
//Can't use __DIR__ as it's only in PHP 5.3+
27+
$filename = dirname(__FILE__).DIRECTORY_SEPARATOR.'class.'.strtolower($classname).'.php';
28+
if (is_readable($filename)) {
29+
require $filename;
30+
}
31+
}
32+
33+
if (version_compare(PHP_VERSION, '5.1.2', '>=')) {
34+
//SPL autoloading was introduced in PHP 5.1.2
35+
if (version_compare(PHP_VERSION, '5.3.0', '>=')) {
36+
spl_autoload_register('PHPMailerAutoload', true, true);
37+
} else {
38+
spl_autoload_register('PHPMailerAutoload');
39+
}
40+
} else {
41+
/**
42+
* Fall back to traditional autoload for old PHP versions
43+
* @param string $classname The name of the class to load
44+
*/
45+
function __autoload($classname)
46+
{
47+
PHPMailerAutoload($classname);
48+
}
49+
}

0 commit comments

Comments
 (0)