-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathprocessForm.php
More file actions
45 lines (36 loc) · 1.24 KB
/
Copy pathprocessForm.php
File metadata and controls
45 lines (36 loc) · 1.24 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
<?php
require __DIR__ . '/vendor/autoload.php';
use PHPMailer\PHPMailer\PHPMailer;
use PHPMailer\PHPMailer\Exception;
// data
$name = $_POST['name'];
$tel = $_POST['tel'];
$email = $_POST['email'];
$message = "Name: " . $name . ", E-Mail: " . $email . ", Telefonnr.: " . $tel . ", Mitteilung: " . $_POST['message'];
$to = '';
$subject = "Malinka-Band Anfrage";
$headers = $_POST['email'];
$mail = new PHPMailer(true);
try {
// Server settings
$mail->isSMTP();
$mail->Host = 'smtp.gmail.com';
$mail->SMTPAuth = true;
$mail->Username = $to;
$mail->Password = '';
$mail->SMTPSecure = PHPMailer::ENCRYPTION_SMTPS;
$mail->Port = 465;
// Recipients
$mail->setFrom($to);
$mail->addAddress($to, 'Tatjana Malinka');
// Content
$mail->isHTML(false);
$mail->Subject = $subject;
$mail->Body = $message;
$mail->AltBody = 'This is the body in plain text for non-HTML mail clients';
$mail->send();
echo 'Message has been sent';
} catch (Exception $e) {
echo "MAILER ERROR, nothing was SEND: {$mail->ErrorInfo}";
}
?>