summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore1
-rw-r--r--index.php64
-rw-r--r--policies/index.php9
3 files changed, 56 insertions, 18 deletions
diff --git a/.gitignore b/.gitignore
index 05d10eb..5958712 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,2 +1,3 @@
_site/
*.core
+PHPMailer-master
diff --git a/index.php b/index.php
index 094f670..a726a08 100644
--- a/index.php
+++ b/index.php
@@ -356,23 +356,9 @@
<!-- contact box -->
<section id="contact">
- <?php
- // handle form submission
- if (isset($_POST['name'], $_POST['email'], $_POST['body'])) {
- $email = filter_var($_POST['email'], FILTER_SANITIZE_EMAIL);
-
- if (!filter_var($email, FILTER_VALIDATE_EMAIL)) {
- echo 'Bad email';
- }
-
- mail('atc@53hor.net', 'test', 'test');
- echo $email;
- echo 'Thank you for your email!';
- }
- ?>
-
<form class="card" action="/#contact" method="post">
<h2>Contact</h2>
+
<label for="name">Name</label>
<input name="name" type="text" id="name" placeholder="Jane Doe" required />
@@ -383,6 +369,54 @@
<textarea name="body" id="body" placeholder="Briefly describe your inquiry, including any services or areas of study you're interested in." required></textarea>
<button type="submit" class="button"><img src="/assets/icons/send-circle.svg" alt="send" />Send</button>
+
+ <?php
+
+ use PHPMailer\PHPMailer\PHPMailer;
+
+ require('PHPMailer-master/src/PHPMailer.php');
+ require('PHPMailer-master/src/SMTP.php');
+ require('PHPMailer-master/src/Exception.php');
+
+ // handle form submission
+ if (isset($_POST['name'], $_POST['email'], $_POST['body'])) {
+ $body = substr(strip_tags($_POST['body']), 0, 16384);
+ $name = substr(strip_tags($_POST['name']), 0, 255);
+
+ if (!PHPMailer::validateAddress($_POST['email'])) {
+ echo 'Bad email';
+ }
+
+ $email = $_POST['email'];
+
+ $smtpuser = file_get_contents('/var/carpentertutoring/smtpuser');
+ $smtppass = file_get_contents('/var/carpentertutoring/smtppass');
+ $address = file_get_contents('/var/carpentertutoring/address');
+
+ $mail = new PHPMailer();
+ $mail->isSMTP();
+ $mail->Host = 'smtp.gmail.com';
+ $mail->Port = 465;
+ $mail->SMTPSecure = PHPMailer::ENCRYPTION_SMTPS;
+ $mail->SMTPAuth = true;
+ $mail->Username = $smtpuser;
+ $mail->Password = $smtppass;
+ $mail->setFrom($smtpuser, $name);
+ $mail->addReplyTo($email, $name);
+ $mail->addAddress($address);
+ $mail->Subject = 'Tutoring Inquiry';
+ $mail->Body = $body;
+
+ if (!$mail->send()) {
+ echo 'There was a problem sending your message. Please try again later or <a href="tel:1-757-335-7555">call (757) 335-7555</a>.';
+ echo '<!--Send error: ' . $mail->ErrorInfo . '-->';
+ } else {
+ echo "Your message was successfully sent.";
+ }
+ } else {
+ echo "Send us a message and we'll reply by mail as soon as possible. Please note that your email address will not be stored on our server. It will only be used to contact you with a reply.";
+ }
+ ?>
</form>
</section>
diff --git a/policies/index.php b/policies/index.php
index 116a755..1fdd037 100644
--- a/policies/index.php
+++ b/policies/index.php
@@ -5,9 +5,12 @@
<section class="quiet">
<p>
<h2>Payment Methods</h2>
- I accept cash, checks made out to Amy Carpenter, or PayPal
- (amy@carpentertutoring.com). If you select to pay through PayPal,
- there is an additional $1.50 processing fee per transaction.
+ I accept payments through PayPal (amy@carpentertutoring.com), Zelle
+ (amy@carpentertutoring.com), and Venmo (@AmyCTutoring). If you select to pay
+ through <b>PayPal</b>, there is an additional <b>$1.50 processing fee</b>
+ per transaction. I also accept cash and checks made out to Amy Carpenter.
+ Please <a href="/#contact">contact me</a> for a mailing address if you are a
+ remote client and would like to pay by check.
</p>
<p>