Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- require 'PHPMailerAutoload.php';
- require 'class.phpmailer.php';
- ?>
- <?php
- $mail = new PHPMailer;
- $mail->isSMTP(true); // Set mailer to use SMTP
- $mail->Host = 'smtp.gmail.com'; // Specify main and backup SMTP servers
- $mail->SMTPAuth = true; // Enable SMTP authentication
- $mail->Username = 'interranetworks.deployment'; // SMTP username
- $mail->Password = 'gerladndoma1234!'; // SMTP password
- $mail->SMTPSecure = 'tls'; // Enable TLS encryption, `ssl` also accepted
- $mail->Port = 587; // TCP port to connect to
- $mail->setFrom($_POST['contact_names'], 'Amfani Website');
- $mail->addAddress('ooyedele@interranetworks.com', 'Amfani Website'); // Add a recipient
- $mail->isHTML(true); // Set email format to HTML
- $mail->Subject = htmlspecialchars($_POST['contact_subject']);
- $mail->Body = '<p>Dear Admin,</p>';
- $mail->Body .= '<p> From '.htmlspecialchars($_POST['contact_names']).'</p>';
- $mail->Body .= '<p>'.htmlspecialchars($_POST['contact_message']).'</p>';
- if(isset($_POST['submit'])){
- if($mail->send()) {
- header( "refresh:5; url=index.php" );
- echo "<p class='contact_success_box'>We have received your message and you'll hear from us soon. Thank You!. <br/> You will be redirected after 5 seconds...</p>";
- }else{
- header( "refresh:5; url=index.php" );
- echo "<p class='contact_success_box'>Opps! Something went wrong. Try again. You will be redirected after 5 seconds...</p>";
- //echo "Mailer Error: " . $mail->ErrorInfo;
- }
- }
- ?>
Add Comment
Please, Sign In to add comment