-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathprocess-smtp.php
More file actions
66 lines (47 loc) · 1.55 KB
/
Copy pathprocess-smtp.php
File metadata and controls
66 lines (47 loc) · 1.55 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
<?php
/*********Mail processing for the form with attachments**********/
require_once("PHPMailer/Exception.php");
require_once("PHPMailer/PHPMailer.php");
require_once("PHPMailer/SMTP.php");
//Create a new PHPMailer instance
$mail = new PHPMailer\PHPMailer\PHPMailer();
//Tell PHPMailer to use SMTP
$mail->isSMTP();
//Enable SMTP debugging
// 0 = off (for production use)
// 1 = client messages
// 2 = client and server messages
$mail->SMTPDebug = 0;
//Set the hostname of the mail server
$mail->Host = 'smtp.gmail.com';
//Set the SMTP port number - likely to be 25, 465 or 587
$mail->Port = 587;
//Whether to use SMTP authentication
$mail->SMTPAuth = true;
//Username to use for SMTP authentication
$mail->Username = 'youraddress@gmail.com';
//Password to use for SMTP authentication
$mail->Password = 'YourGmailPassword';
$mail->SMTPSecure = 'tls';
//Set who the message is to be sent from
$mail->setFrom($_POST["email"], $_POST["name"]);
//Set an alternative reply-to address
$mail->addReplyTo($_POST["email"], $_POST["name"]);
//Set who the message is to be sent to
$mail->addAddress('claudiu.d@centruldesoft.ro');
//Set the subject line
$mail->Subject = "Ai primit email";
$message = "Nume: ".$_POST["name"].", /n".
"Pachet ales: ".$_POST["package"].", /n".
"Telefon: ".$_POST["tel"].", /n".
"Adresa Email: ".$_POST["email"];
$mail->MsgHTML($message);
$mail->IsHTML(true);
//send the message, check for errors
if (!$mail->send()) {
echo 'Mailer Error: ' . $mail->ErrorInfo;
} else {
//echo 'Message sent!';
header('Location: index.html');
}
?>