Jump to content

emcuriah

New Members
  • Posts

    2
  • Joined

  • Last visited

Everything posted by emcuriah

  1. Hello, thanks for opening this first and foremost. So i've been designing a website for myself here . On the last page is a contact form that i've been trying to figure out. This was a html web template that i had purchased and replaced with my own info, pics etc. everything is fully functional but i cannot figure out how to set up my handler.php file to route the contact form back to my gmail. The only directions on the contact form was to "refer to handler.php". I have attached a copy of that file, I think i have filled out the information correctly but still has error submitting contact form after uploading to aws. I'm really new to html or php, just trying to self teach myself but i havent been able to solute it with any research i've been looking up. Any guidance or info to where i might be going left is beyond appreciated. Bless, -MC ------------ <?php use PHPMailer\PHPMailer\PHPMailer; use PHPMailer\PHPMailer\Exception; require 'file:///SSD/Users/mc/Documents/sites/elements-mikael-modern-creative-cvresume-template-28H8B9D-R78y6RFN-06-06/Mikael HTML/php/PHPMailer-5.2.28/src/Exception.php'; require 'file:///SSD/Users/mc/Documents/sites/elements-mikael-modern-creative-cvresume-template-28H8B9D-R78y6RFN-06-06/Mikael HTML/php/PHPMailer-5.2.28/src/PHPMailer.php'; require 'file:///SSD/Users/mc/Documents/sites/elements-mikael-modern-creative-cvresume-template-28H8B9D-R78y6RFN-06-06/Mikael HTML/php/PHPMailer-5.2.28/src/SMTP.php'; $mail = new PHPMailer(true); $mail_subject = 'Subject'; $mail_to_email = 'emcuriah@gmail.com'; // your email $mail_to_name = 'Webmaster'; try { $mail_from_name = isset( $_POST['name'] ) ? $_POST['name'] : ''; $mail_from_email = isset( $_POST['email'] ) ? $_POST['email'] : ''; $mail_category = isset( $_POST['category'] ) ? $_POST['category'] : ''; $mail_budget = isset( $_POST['budget'] ) ? $_POST['budget'] : ''; $mail_message = isset( $_POST['message'] ) ? $_POST['message'] : ''; // Server settings $mail->isSMTP(); // Send using SMTP $mail->Host = 'smtp.gmail.com'; // Set the SMTP server to send through $mail->SMTPAuth = true; // Enable SMTP authentication $mail->Username = 'emcuriah@gmail.com'; // SMTP username $mail->Password = '...'; // SMTP password $mail->SMTPSecure = PHPMailer::ENCRYPTION_SMTPS; // Enable TLS encryption; `PHPMailer::ENCRYPTION_SMTPS` encouraged $mail->Port = 465; // TCP port to connect to, use 465 for `PHPMailer::ENCRYPTION_SMTPS` above $mail->setFrom($mail_to_email, $mail_to_name); // Your email $mail->addAddress($mail_from_email, $mail_from_name); // Add a recipient // for($ct=0; $ct<count($_FILES['file_attach']['tmp_name']); $ct++) { // $mail->AddAttachment($_FILES['file_attach']['tmp_name'][$ct], $_FILES['file_attach']['name'][$ct]); // } // Content $mail->isHTML(true); // Set email format to HTML $mail->Subject = $mail_subject; $mail->Body = ' <strong>Name:</strong> ' . $mail_from_name . '<br> <strong>Email:</strong> ' . $mail_from_email . '<br> <strong>Category:</strong> ' . $mail_category . '<br> <strong>Budget:</strong> ' . $mail_budget . '<br> <strong>Message:</strong> ' . $mail_message; $mail->Send(); echo 'Message has been sent!'; } catch (Exception $e) { echo "Message could not be sent. Mailer Error: {$mail->ErrorInfo}"; }
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.