-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsendmail.php
More file actions
97 lines (51 loc) · 1.6 KB
/
sendmail.php
File metadata and controls
97 lines (51 loc) · 1.6 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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
<?php
use PHPMailer\PHPMailer\PHPMailer;
use PHPMailer\PHPMailer\SMTP;
use PHPMailer\PHPMailer\Exception;
require_once "PHPMailer/src/PHPMailer.php";
require_once "PHPMailer/src/SMTP.php";
require_once "PHPMailer/src/Exception.php";
$mail = new PHPMailer(true);
//Enable SMTP debugging.
$mail->SMTPDebug = 0; //0 or 2
//Set PHPMailer to use SMTP.
$mail->isSMTP();
//Set SMTP host name
$mail->Host = "smtp.gmail.com";
//Set this to true if SMTP host requires authentication to send email
$mail->SMTPAuth = true;
$mail->SMTPOptions = array(
'ssl' => array(
'verify_peer' => false,
'verify_peer_name' => false,
'allow_self_signed' => true
)
);
//Provide username and password
$mail->Username = "TMDBmovierate@gmail.com";
$mail->Password = "TMDBmovierate@12345";
//If SMTP requires TLS encryption then set it
$mail->SMTPSecure = "tls";
//Set TCP port to connect to
$mail->Port = 587;
$mail->From = "TMDBmovierate@gmail.com";
$mail->FromName = "TMDB";
$mail->addAddress("TMDBmovierate@gmail.com", "TMDB");
$mail->isHTML(true);
$mail->Subject = "mail from user";
$message = "
<table>
<tr><td>Name: </td><td>" . $_POST["full_name"] . "</td></tr>
<tr><td>Mobile No.: </td><td>" . $_POST["mobile_number"] . "</td></tr>
<tr><td>Email: </td><td>" . $_POST["email"] . "</td></tr>
<tr><td>Message: </td><td>" . $_POST["message"] . "</td></tr>
</table>
";
$mail->Body = $message;
try {
$mail->send();
echo "<h2>Message has been sent successfully</h2>";
} catch (Exception $e) {
echo "Mailer Error: " . $mail->ErrorInfo;
}
?>