-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmail.php
47 lines (38 loc) · 1.4 KB
/
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
<?php
require_once('../PHPMailer/PHPMailerAutoload.php');
require_once('recaptchalib.php');
require_once('params.php');
$resp = recaptcha_check_answer($params->captcha_key, $_SERVER["REMOTE_ADDR"], $_POST["recaptcha_challenge_field"], $_POST["recaptcha_response_field"]);
if (!$resp->is_valid && false) {
die ("The reCAPTCHA wasn't entered correctly. Go back and try it again." .
"(reCAPTCHA said: " . $resp->error . ")");
} else {
$realm = $_POST['realm'];
$armory = 'http://' . $_POST['armory'];
$character = $_POST['character'];
$statement = $_POST['statement'];
$email = <<<EOM
Character name: $character
Realm: $realm
Armory: $armory
Statement:
$statement
EOM;
$subject = "Guild application: $character";
$mail = new PHPMailer;
$mail->isSMTP();
$mail->Host = $params->mail['smtp_host'];
$mail->SMTPAuth = true;
$mail->Username = $params->mail['from'];
$mail->Password = $params->mail['password'];
$mail->SMTPSecure = 'tls';
$mail->From = $params->mail['from'];
$mail->FromName = $params->mail['from_name'];
$mail->Subject = $subject;
$mail->Body = $email;
foreach ($params->mail['recipients'] as $recipient) {
$mail->addAddress($recipient);
}
$mail->send();
header('Location: /?success');
}