-
Notifications
You must be signed in to change notification settings - Fork 1
/
htmlMail_1.php
129 lines (119 loc) · 4.13 KB
/
htmlMail_1.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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
<!doctype html>
<html>
<!-- InstanceBegin template="/Templates/basis.dwt.php" codeOutsideHTMLIsLocked="false" -->
<head>
<?php require_once('ssi/head.php'); ?>
<!-- InstanceBeginEditable name="doctitle" -->
<title>HTML mail</title>
<!-- InstanceEndEditable -->
<!-- InstanceBeginEditable name="head" -->
<script>
$(function(){
// ckeditor http://ckeditor.com/latest/samples/plugins/toolbar/toolbar.html
$('textarea').ckeditor({
format_tags : 'h2;h3;h4;p',
toolbar: [
['BulletedList', 'NumberedList', 'Bold', 'Italic', 'Image', '-', 'Link', 'Unlink' ],
[ 'Paste', 'PasteText', 'PasteFromWord', '-', 'RemoveFormat', '-', 'Undo', 'Redo', '-', 'Smiley', 'SpecialChar'],
'/',
[ 'Format', 'Font', 'FontSize', '-', 'Maximize', 'Source' ]
]
});
})
</script>
<!-- InstanceEndEditable -->
</head>
<body>
<!-- Menu Horizontal -->
<?php require_once('ssi/navigatie.php'); ?>
<div id="main" class="container" ><!-- InstanceBeginEditable name="data" -->
<div class="page-header col-sm-12">
<h1>HTML e-mail <small>(inline HTML)</small></h1>
</div>
<div class="col-sm-12">
<div id="debugInfo">
<?php
require_once('PHPMailer/PHPMailerAutoload.php');
require_once('ssi/mail.config.php');
$From = $mail->Username;
$FromName = 'Mijn naam';
if ($_POST['Submit'] <> "") {
$mail->SMTPDebug = 2;
$mail->Debugoutput = 'html';
$mail->SetFrom ($From, $FromName);
$mail->AddAddress ($_POST["aanEmail"], $_POST["aanNaam"]);
$mail->Subject = $_POST["onderwerp"];
$mail->IsHTML();
$mail->MsgHTML ($_POST["body"] . '<img src="assets/phpmailer_mini.png">');
$mail->addAttachment('assets/phpmailer.png', 'logo PHPmailer');
try {
$mail->Send();
echo "<div class='alert alert-success'><p>E-mail verzonden.</p></div>";
} catch (phpmailerException $e) {
echo "<div class='alert alert-danger'><p>E-mail NIET verzonden:</p>";
echo $e->errorMessage(); //Pretty error messages from PHPMailer
echo "</div>";
} catch (Exception $e) {
echo "<div class='alert alert-danger'><p>E-mail NIET verzonden:</p>";
echo $e->getMessage(); //Boring error messages from anything else!
echo "</div>";
}
}
?>
</div>
</div>
<div class="col-sm-7">
<form id="mailform" name="mailform" method="post">
<div class="form-group">
<label>Van: </label><br><?php echo $FromName ?> <<?php echo $From ?>>
</div>
<div class="form-group">
<label for="aanNaam">Aan:</label>
<input type="text" required name="aanNaam" id="aanNaam" value="<?php echo $_POST['aanNaam']; ?>">
</div>
<div class="form-group">
<label for="aanEmail">Aan e-mail:</label>
<input type="email" required name="aanEmail" id="aanEmail" value="<?php echo $_POST['aanEmail']; ?>">
</div>
<div class="form-group">
<label for="onderwerp">Onderwerp:</label>
<input type="text" required name="onderwerp" id="onderwerp" value="<?php echo $_POST['onderwerp']; ?>">
</div>
<div class="form-group">
<label for="body">Body:</label>
<textarea required class="form-control" rows="3" name="body" id="body"><?php echo $_POST['body']; ?></textarea>
</div>
<label></label>
<input name="Submit" type="submit" value="Verzenden" class="btn btn-primary">
</form>
</div>
<div class="col-sm-5">
<h3>Snippets</h3>
<pre class="text-info">
<?php
$code = <<<'CODE'
// Formulier met enkel een tekstboodschap
$mail->Body = 'Tekstboodschap';
// Formulier met multipart tekst en HTML boodschap
$mail->IsHTML();
$mail->AltBody = 'Tekstversie van de boodschap';
$mail->Body = '<p>HTML versie van de boodschap</p>
<p>img src="/assets/phpmailer_mini.png">';
// Laat $mail->AltBody weg
// Vervang $mail->Body door $mail->MsgHTML()
// Tekstversie is nu default de gestripte HTML-versie
$mail->IsHTML();
$mail->MsgHTML ('<p>HTML + tekstversie van de boodschap</p>
<p>img src="/assets/phpmailer_mini.png">');
// Bijlage toevoegen (naam is optioneel)
$mail->addAttachment('/assets/phpmailer.png', 'logo PHPmailer');
$mail->addAttachment('/assets/phpmailer_mini.png');
CODE;
echo $code;
?>
</pre>
</div>
<!-- InstanceEndEditable --></div>
</body>
<!-- InstanceEnd -->
</html>