-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcontactController.php
More file actions
69 lines (51 loc) · 2.16 KB
/
contactController.php
File metadata and controls
69 lines (51 loc) · 2.16 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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
<?php
require 'PHPMailer-master\PHPMailer-master\PHPMailerAutoload.php';
//echo "here";
if($_SERVER['REQUEST_METHOD']=='POST'){
$name=test_input($_POST['name']);
$email=test_input($_POST['email']);
$phone=test_input($_POST['phone']);
$subject=test_input($_POST['subject']);
$message=test_input($_POST['message']);
$mess=$name."\n".$phone."\n".$message;
$mail = new PHPMailer;
//$mail->SMTPDebug = 3; // Enable verbose debug output
$mail->isSMTP(); // Set mailer to use SMTP
$mail->Host = 'mail.forshorelending.com'; // Specify main and backup SMTP servers
$mail->SMTPAuth = true; // Enable SMTP authentication
$mail->Username = 'loans@forshorelending.com'; // SMTP username
$mail->Password = 'Abraham_123'; // SMTP password
//$mail->SMTPSecure = 'tls'; // Enable TLS encryption, `ssl` also accepted
$mail->Port = 25; // TCP port to connect to
$mail->confirmReadingTo='loans@forshorelending.com';
$mail->addReplyTo($email,$name);
$mail->setFrom($email,$name);
$mail->addAddress('loans@forshorelending.com', 'Admin'); // Add a recipient
//$mail->addAddress('ellen@example.com'); // Name is optional
//$mail->addReplyTo('info@example.com', 'Information');
//$mail->addCC('cc@example.com');
//$mail->addBCC('bcc@example.com');
//$mail->addAttachment('doc.pdf'); // Add attachments
//$mail->addAttachment('/tmp/image.jpg', 'new.jpg'); // Optional name
$mail->isHTML(true); // Set email format to HTML
$mail->Subject = $subject;
$mail->Body = $mess;
$mail->AltBody = $mess;
if(!$mail->send()) {
$mess="Message could not be sent.Please try again";
header("Location:contactsuccess.php?message=$mess");
exit();
//echo 'Mailer Error: ' . $mail->ErrorInfo;
} else {
$mess="Message successfully sent!";
header("Location:contactsuccess.php?message=$mess");
exit();
}
}
function test_input($data) {
$data = trim($data);
$data = stripslashes($data);
$data = htmlspecialchars($data);
return $data;
}
?>