-
Notifications
You must be signed in to change notification settings - Fork 1
/
mail.php
executable file
·79 lines (65 loc) · 2.6 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
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
<?php
require_once('config.php');
function from_header($n)
{
switch ($n) {
case 2:
return "From: Piratenpartei Newsletter <[email protected]>\r\n";
case 4:
return "From: Piratenpartei Newsletter <[email protected]>\r\n";
case 8:
return "From: Piratenpartei Newsletter <[email protected]>\r\n";
case 16:
return "From: Piratenpartei Newsletter <[email protected]>\r\n";
case 32:
return "From: Piratenpartei Newsletter <[email protected]>\r\n";
case 64:
return "From: Piratenpartei Newsletter <[email protected]>\r\n";
case 128:
return "From: Piratenpartei Newsletter <[email protected]>\r\n";
case 256:
return "From: Piratenpartei Newsletter <[email protected]>\r\n";
case 512:
return "From: Piratenpartei Newsletter <[email protected]>\r\n";
default:
return "From: Piratenpartei Newsletter <[email protected]>\r\n";
}
}
function base64_url_encode($input)
{
return strtr(base64_encode($input), '+/=', '-_$');
}
function base64_url_decode($input)
{
return base64_decode(strtr($input, '-_$', '+/='));
}
function mail_utf8($db, $to, $subject, $message, $from, $unsubscribe_link = null)
{
$subject = "=?UTF-8?B?".base64_encode($subject)."?=";
$headers = $from;
$headers .= "MIME-Version: 1.0\r\nContent-type: text/plain; charset=UTF-8\r\n";
$message .= '
--
Piratenpartei Österreichs
Impressum: https://wiki.piratenpartei.at/wiki/Piratenwiki:Impressum
Kontakt zur TF Newsletter (öffentlich!): [email protected]';
if ($unsubscribe_link != null)
{
$message .= '
Einstellungen ändern bzw. Abmeldung vom Newsletter: ' . $unsubscribe_link;
}
$to = base64_encode($to);
$subject = base64_encode($subject);
$message = base64_encode($message);
$headers = base64_encode($headers);
$db->query("INSERT INTO mail_queue (mto,msubject,mbody,mheaders) VALUES ('$to', '$subject', '$message', '$headers');");
return true;
}
function change_link($sid,$page = 'change')
{
global $baseUrl,$key;
$date = new DateTime();
$rand = mt_rand();
return $baseUrl.$page.".php?s=" . $rand . "&q=" . base64_url_encode(mcrypt_encrypt(MCRYPT_RIJNDAEL_256, $key , $sid . '|' . $date->getTimestamp(), MCRYPT_MODE_CBC));
}
?>