-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsend_mail.php
63 lines (50 loc) · 1.76 KB
/
send_mail.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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
<?php
########### CONFIG ###############
$recipient = $_POST['email'];
$timestamp = time();
$link = "https://oliver-jung.developerakademie.net/join/reset-password.html?email=" . $recipient . "×tamp=" . $timestamp;
$message = "Hello, \r\n
you can reset your password by clicking on the link below: \r\n
$link \r\n
Best greetings
Customer Service
Join Kanban Board";
$redirect = 'request-sended.html';
########### CONFIG END ###########
########### Intruction ###########
#
# This script has been created to send an email to the $recipient
#
# 1) Upload this file to your FTP Server
# 2) Send a POST rewquest to this file, including
# [name] The name of the sender (Absender)
# [message] Message that should be send to you
#
##################################
###############################
#
# DON'T CHANGE ANYTHING FROM HERE!
#
# Ab hier nichts mehr ändern!
#
###############################
switch ($_SERVER['REQUEST_METHOD']) {
case ("OPTIONS"): //Allow preflighting to take place.
header("Access-Control-Allow-Origin: *");
header("Access-Control-Allow-Methods: POST");
header("Access-Control-Allow-Headers: content-type");
exit;
case ("POST"): //Send the email;
header("Access-Control-Allow-Origin: *");
$subject = "Password reset Join Kanban Board";
$headers = array();
$headers[] = "MIME-Version: 1.0";
$headers[] = "Content-type: text/plain; charset=utf-8";
$headers[] = "From: [email protected]";
mail($recipient, $subject, $message, implode("\r\n", $headers));
header("Location: " . $redirect);
break;
default: //Reject any non POST or OPTIONS requests.
header("Allow: POST", true, 405);
exit;
}