Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialMike Hansen
Python Web Development Techdegree Student 3,419 Pointsphpmailer auto reply
Hi, is there anyway i can make a Auto Reply so when they for example press Submit Media it automatically let's them know we got their email in a email? Searched through the web but with no luck really..
1 Answer
Matthew Bilz
15,829 PointsOf course. You just add the PHPMailer function to your code and it will run every time you ask it to.
For instance - make sure you include the PHPMailer autoloader in your include files.
Then - just an example - set your HTML form action to direct itself to a PHP script page upon someone hitting SUBMIT that includes the PHP Mailer function filled out to your specifications. You can then redirect back to any page or a thank you page or whatever you'd like after the mail script executes (usually something along the line of the following):
<?php
if(!$mail->send()) {
echo 'There was an error sending the contact form email. <br>';
echo 'Mailer Error: ' . $mail->ErrorInfo;
} else {
header("Location:my_email_confirm_page.php");
}
?>
I hope this helps at all!