diff options
author | Adam T. Carpenter <atc@53hor.net> | 2024-06-09 15:55:18 -0400 |
---|---|---|
committer | Adam T. Carpenter <atc@53hor.net> | 2024-06-09 15:55:18 -0400 |
commit | 67d362b9976d99975f10da46ee900122576e2b3e (patch) | |
tree | 0d86da532ce9df48b88ec0b644566dc3b20674e0 /index.php | |
parent | 550c00de731cd09643f2857a237d9fbde22890d5 (diff) | |
download | carpentertutoring-brochure.tar.xz carpentertutoring-brochure.zip |
feat: replace contact form with direct email linkbrochure
Diffstat (limited to 'index.php')
-rw-r--r-- | index.php | 75 |
1 files changed, 1 insertions, 74 deletions
@@ -19,7 +19,7 @@ include('header.php'); </h2> <div class="buttons"> - <a class="button" href="/#contact"> <img src="/assets/icons/email-variant.svg" alt="mailbox" /> Send a message</a> + <a class="button" href="mailto:amy@carpentertutoring.com"> <img src="/assets/icons/email-variant.svg" alt="mailbox" />Amy@CarpenterTutoring.com</a> <a class="button primary" href="tel:1-757-335-7555"> <img src="/assets/icons/phone-classic.svg" alt="phone" /> (757) 335-7555</a> @@ -359,79 +359,6 @@ include('header.php'); </section> -<!-- contact box --> -<section id="contact"> - <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 /> - - <label for="email">Email Address*</label> - <input name="email" type="email" id="email" placeholder="jdoe85@aol.com" required /> - - <label for="phone">Phone Number</label> - <input name="phone" type="tel" id="phone" pattern="^\s*\(?[0-9]{3}\)?\s*[-.\s]?[0-9]{3}[-.\s]?[0-9]{4}$" maxlength="11" placeholder="7573357555" title="e.g., (757) 335-7555 , 757-335-7555, 7573357555" /> - - <label for="body">Question/Comment*</label> - <textarea name="body" id="body" placeholder="Briefly describe your inquiry, including any services or areas of study you're interested in." required></textarea> - - <textarea name="beehive" id="beehive" placeholder="Please leave this field blank."></textarea> - - <button type="submit" class="button"><img src="/assets/icons/send-circle.svg" alt="send" />Send</button> - - <?php - - use PHPMailer\PHPMailer\PHPMailer; - - require('/usr/local/share/phpmailer/PHPMailer.php'); - require('/usr/local/share/phpmailer/SMTP.php'); - require('/usr/local/share/phpmailer/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']; - $phone = $_POST['phone']; - - $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($email, $name); - $mail->addAddress($address); - $mail->addReplyTo($email); - $mail->Subject = "Tutoring Inquiry from $email $phone"; - $mail->Body = $body; - - if (!$mail->send()) { - echo 'There was a problem sending your message. Please try again later or send mail to <a href="mailto:amy@carpentertutoring.com">Amy@CarpenterTutoring.com</a>.'; - echo '<!--Send error: ' . $mail->ErrorInfo . '-->'; - error_log($mail->ErrorInfo); - } else { - echo "Your message was successfully sent."; - } - } else { - echo 'Send us a message and we`ll reply by mail or phone as soon as possible. Please note that your personal data will not be stored on our system; it will only be used to contact you with a reply. You may also send mail directly to <a href="mailto:amy@carpentertutoring.com">Amy@CarpenterTutoring.com</a>.'; - } - ?> - </form> - -</section> - <!-- reviews --> <section id="reviews"> |