如何通过电子邮件(或其他选项)发送联系表单数据

I'm wondering what options are available to send an e-mail to my e-mail account when someone fills out my contact form. My setup is on AWS with an instance of Microsoft 2012 Server running.

I have IIS, PHP5.6 and have a local SMTP server running and working (I've successfully sent test e-mails on my local environment). It seems no matter what I attempt to try and send my contact form data via e-mail, it fails.

I've tried using Pear and PHPMailer, both always throw errors. I've tried troubleshooting these errors for the past 8 hours via the documentation and scouring websites (including Stack Overflow). I'm stuck and don't know what to attempt next. Is there something I'm missing like another option? This is my first time setting up my own server and it's been a huge hassle (although I think it will pay off in the end once I understand everything more). If PHPMailer is what I need to be using I can paste in my code, I've been working of the gmail example.

The current error I have with PHPMailer:

2016-01-01 01:45:32 CLIENT -> SERVER: EHLO www.xeno-studios.com 2016-01-01 01:45:32 CLIENT -> SERVER: STARTTLS 2016-01-01 01:45:32 SMTP Error: Could not connect to SMTP host. 2016-01-01 01:45:32 CLIENT -> SERVER: QUIT 2016-01-01 01:45:32 SMTP ERROR: QUIT command failed: 2016-01-01 01:45:32 SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting Mailer Error: SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting

//example.php
<?php
require 'phpmailer/PHPMailerAutoload.php';

    $mail = new PHPMailer(); // create a new object
    $mail->IsSMTP(); // enable SMTP
    $mail->SMTPDebug = 1; // debugging: 1 = errors and messages, 2 = messages only
    $mail->SMTPAuth = true; // authentication enabled
    //$mail->SMTPSecure = 'tls'; // secure transfer enabled REQUIRED for GMail
    $mail->Host = gethostbyname('smtp.gmail.com');
    $mail->Port = 587; // or 587
    $mail->IsHTML(true);
    $mail->Username = "myemail@gmail.com";
    $mail->Password = "gmailpass";
    $mail->SetFrom("myemail@gmail.com");
    $mail->Subject = "Test";
    $mail->Body = "hello";
    $mail->AddAddress("recipient@gmail.com");
    if(!$mail->Send()){
          echo "Mailer Error: " . $mail->ErrorInfo;
   } else {
     echo "Message has been sent";
   }
?>

This must have been failing because of the Google smtp server. Apparently they have been changing the way people get authenticated which could be part of the reason I was getting errors. I ended up looking into AWS SES for my mail server setup and used those credentials in my PHPMailer function. It was rather easy to setup and worked like a charm.