aboutsummaryrefslogtreecommitdiff
path: root/bootstrap/Functions.php
diff options
context:
space:
mode:
authorThedro Neely <thedroneely@gmail.com>2018-08-30 04:40:53 -0400
committerThedro Neely <thedroneely@gmail.com>2018-08-30 04:40:53 -0400
commit2659205908bd5cab508f4ff817123673e078ab74 (patch)
treee455f36b124e9b98f7005e6d4310b71881734623 /bootstrap/Functions.php
downloadedwinmattiacci.com-2659205908bd5cab508f4ff817123673e078ab74.tar.gz
edwinmattiacci.com-2659205908bd5cab508f4ff817123673e078ab74.tar.bz2
edwinmattiacci.com-2659205908bd5cab508f4ff817123673e078ab74.zip
Initialize Repo: First Commit
Diffstat (limited to 'bootstrap/Functions.php')
-rw-r--r--bootstrap/Functions.php58
1 files changed, 58 insertions, 0 deletions
diff --git a/bootstrap/Functions.php b/bootstrap/Functions.php
new file mode 100644
index 0000000..2308f9b
--- /dev/null
+++ b/bootstrap/Functions.php
@@ -0,0 +1,58 @@
+<?php
+
+// PHP mailer namespace.
+use PHPMailer\PHPMailer\PHPMailer;
+use PHPMailer\PHPMailer\Exception;
+
+function sendMail($name, $email, $message)
+{
+ // Require mail config
+ $config = require '../AppConfig.php';
+
+ $mail = new PHPMailer(true);
+ try {
+ //Server settings
+ //$mail->SMTPDebug = 2; // Enable verbose debug output
+ $mail->isSMTP(); // Set mailer to use SMTP
+ $mail->Host = $config['mail']['host']; // Specify main and backup SMTP servers
+ $mail->SMTPAuth = true; // Enable SMTP authentication
+ $mail->Username = $config['mail']['username']; // SMTP username
+ $mail->Password = $config['mail']['password']; // SMTP password
+ $mail->SMTPSecure = 'ssl'; // Enable TLS encryption, `ssl` also accepted
+ $mail->Port = $config['mail']['port']; // TCP port to connect to
+
+ //Recipients
+ $mail->setFrom('edwinmattiacci@yahoo.com', 'Edwin Mattiacci');
+ $mail->addAddress('edwinmattiacci@yahoo.com', 'Edwin Mattiacci');
+ $mail->addReplyTo($email, $name);
+
+ //Content
+ $mail->isHTML(true);
+ $mail->Subject = 'New message from ' . $name;
+ $mail->Body = $message;
+ $mail->AltBody = $message;
+
+ $mail->send();
+ } catch (Exception $e) {
+ require '../views/senterror.view.php';
+ }
+}
+
+function webTitle()
+{
+ switch ($_SERVER['REQUEST_URI']) {
+ case '/feedback/':
+ $uri = $_SERVER['REQUEST_URI'];
+ echo $titleHeader = 'Feedback';
+ break;
+
+ case '/contact/':
+ $uri = $_SERVER['REQUEST_URI'];
+ echo $titleHeader = 'Contact';
+ break;
+
+ default:
+ $uri = '/';
+ echo $titleHeader = 'Voiceover';
+ }
+}