-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathhandler.php
More file actions
57 lines (42 loc) · 1.98 KB
/
handler.php
File metadata and controls
57 lines (42 loc) · 1.98 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
<?php
use PHPMailer\PHPMailer\PHPMailer;
use PHPMailer\PHPMailer\Exception;
require 'php/PHPMailer-5.2.28/src/Exception.php';
require 'php/PHPMailer-5.2.28/src/PHPMailer.php';
require 'php/PHPMailer-5.2.28/src/SMTP.php';
$mail = new PHPMailer(true);
$mail_subject = 'Subject';
$mail_to_email = 'contact@techyhoney.in'; // your email
$mail_to_name = 'Webmaster';
try {
$mail_from_name = isset( $_POST['name'] ) ? $_POST['name'] : '';
$mail_from_email = isset( $_POST['email'] ) ? $_POST['email'] : '';
$mail_category = isset( $_POST['category'] ) ? $_POST['category'] : '';
$mail_budget = isset( $_POST['budget'] ) ? $_POST['budget'] : '';
$mail_message = isset( $_POST['message'] ) ? $_POST['message'] : '';
// Server settings
$mail->isSMTP(); // Send using SMTP
$mail->Host = 'mail.techyhoney.in'; // Set the SMTP server to send through
$mail->SMTPAuth = true; // Enable SMTP authentication
$mail->Username = 'contact@techyhoney.in'; // SMTP username
$mail->Password = '8!zW3)O3fUqwI2'; // SMTP password
$mail->SMTPSecure = PHPMailer::ENCRYPTION_SMTPS; // Enable TLS encryption; `PHPMailer::ENCRYPTION_SMTPS` encouraged
$mail->Port = 465; // TCP port to connect to, use 465 for `PHPMailer::ENCRYPTION_SMTPS` above
$mail->setFrom($mail_from_email, $mail_from_name); // Your email
$mail->addAddress($mail_to_email, $mail_to_name); // Add a recipient
// for($ct=0; $ct<count($_FILES['file_attach']['tmp_name']); $ct++) {
// $mail->AddAttachment($_FILES['file_attach']['tmp_name'][$ct], $_FILES['file_attach']['name'][$ct]);
// }
// Content
$mail->isHTML(true); // Set email format to HTML
$mail->Subject = $mail_subject;
$mail->Body = '
<strong>Name:</strong> ' . $mail_from_name . '<br>
<strong>Email:</strong> ' . $mail_from_email . '<br>
<strong>Category:</strong> ' . $mail_category . '<br>
<strong>Message:</strong> ' . $mail_message;
$mail->Send();
echo 'Message has been sent';
} catch (Exception $e) {
echo "Message could not be sent. Mailer Error: {$mail->ErrorInfo}";
}