-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcontact.php
More file actions
52 lines (43 loc) · 1.52 KB
/
contact.php
File metadata and controls
52 lines (43 loc) · 1.52 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
<?php
require('phpmailer/class.phpmailer.php');
require('phpmailer/class.smtp.php');
if(isset($_POST['email'])){
$to = htmlspecialchars($_POST['email']);
$from = 'robert@robertnolteconstruction.com';
$name = htmlspecialchars($_POST['name']);
$sub = htmlspecialchars($_POST['subject']);
$msg = htmlspecialchars($_POST['message']);
$mail = new PHPMailer();
//Enable SMTP debugging.
//$mail->SMTPDebug = 3;
//Set PHPMailer to use SMTP.
$mail->isSMTP();
//Set SMTP host name
$mail->Host = "mail.robertnolteconstruction.com";
//Set this to true if SMTP host requires authentication to send email
$mail->SMTPAuth = true;
//Provide username and password
$mail->Username = "sender@robertnolteconstruction.com";
$mail->Password = "";
//If SMTP requires TLS encryption then set it
//$mail->SMTPSecure = "tls";
//Set TCP port to connect to
$mail->Port = 25;
$mail->From = $from;
$mail->FromName = $name;
$mail->addAddress("rdnolte@ctcis.net", 'Robert Nolte');
$mail->isHTML(true);
$mail->Subject = $sub;
$mail->Body = $msg;
$mail->AltBody = $msg;
if($mail->send()){
echo 'success';
}
else{
echo 'Error Sending Message, Please Contact rdnolte@ctcis.net. Error Code: 1';
}
}
else{
echo 'Error Sending Message, Please Contact rdnolte@ctcis.net. Error Code: 2';
}
?>