-
Notifications
You must be signed in to change notification settings - Fork 0
/
email.php
36 lines (34 loc) · 1.42 KB
/
email.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
<?php
require_once 'main.php';
function leuke_mail($email, $subject, $html, $css = '')
{
require_once 'CssToInlineStyles.php';
$converter = new TijsVerkoyen\CssToInlineStyles\CssToInlineStyles($html, $css);
mail($email,
$subject,
$converter->convert(),
"From: \"Super Internet Shop\" <[email protected]>\r\nContent-type: text/html");
}
function bestelling_mail($bestelling_id, $subject, $message)
{
$db = connect_to_db();
$email_sql = $db->prepare("SELECT email FROM Gebruikers JOIN Bestellingen ON Gebruikers.id = gebruiker_id WHERE Bestellingen.id = ?");
$email_sql->bind_param('i', $bestelling_id);
$email_sql->bind_result($email);
$email_sql->execute();
if ($email_sql->fetch())
{
require_once 'bestelling-weergeven.php';
$html = "<html>
<body>
$message<br/>Hier is nogmaals te zien wat u precies besteld heeft:<br/>" . bestelling_weergeven($bestelling_id, TRUE) .
"</body>
</html>";
$css = file_get_contents('main.css') . "\n\n" .
file_get_contents('productlijst.css') . "\n\n" .
file_get_contents('adresweergave.css');
leuke_mail($email, $subject, $html, $css);
}
$email_sql->free_result();
}
?>