-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcontact.php
41 lines (37 loc) · 1.3 KB
/
contact.php
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
<?php
$first_name="First Name : ".$_POST['first_name']."<br>";
$last_name="Last Name :". $_POST['last_name']. "<br>";
$your_email="Your Email :".$_POST['email']. "<br>";
$telephone="Your Telephone :".$_POST['telephone']. "<br>";
$your_message="Your Comments :".$_POST['comments']. "<br>";
$message = "
\n $first_name \n
\n $last_name \n
\n $your_email \n
\n $telephone \n
\n $your_message \n
";
echo $message;
include "PHPMailer_5.2.4/class.phpmailer.php";
$mail = new PHPMailer;
$mail->isSMTP();
$mail->Host = 'smtp.gmail.com';
$mail->SMTPAuth = true;
$mail->Username = '[email protected]';
$mail->Password = 'stmarysschool';
$mail->SMTPSecure = 'tls';
$mail->Port = 587;
$mail->setFrom('[email protected]', 'Mailer');
$mail->addAddress($your_email, 'Name');
$mail->addAttachment('fileaddress');
$mail->isHTML(true);
$mail->Subject = 'Here is the subject';
$mail->Body = $message;
$mail->AltBody = 'This is the body in plain text for non-HTML mail clients';
if(!$mail->send()) {
echo 'Message could not be sent.';
echo 'Mailer Error: ' . $mail->ErrorInfo;
} else {
echo 'Message has been sent';
}
?>