Mail sturen
Ik ben bezig met een klein nieuwsbriefsysteem en stuit al snel op een fout.
Ik heb al gezocht enzo maar ik weet niet hoe ik het op los.
De code
Code (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
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
<?
if($link = "sturen"){
if(isset($_POST['sturen'])){
if(empty($_POST['code'])){
exit("");
}else{
$bericht = $_POST['code'];
}
$mailsql = "SElECT * FROM email";
$mailres = mysql_query($mailsql);
while($mail = mysql_fetch_array($mailres)){
$naam = $mail['naam'];
$uitschrijflink = "uitschrijven.php?email=" . $mail['email'];
$email = $mail['email'];
$bericht = ereg_replace('"', '\\"', $bericht);
$bericht = nl2br($bericht);
$naar = $mail['naam'] . " <" . $mail['email'] . ">";
require("config.php");
// HTML headers
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
// Basis headers
$headers .= 'From: ' . $naambv . ' <' . $emailbv . '>' . "\r\n";
//mailen
mail($naar, $ond, $bericht, $headers);
}
}else{
?>
<p><b><font face="Trebuchet MS">Nieuwsbrief versturen</font></b></p>
<table border="0" width="100%" id="table1">
<tr>
<td width="622"><font face="Trebuchet MS">Volledige naam</font></td>
<td><font face="Trebuchet MS">[naam] </font></td>
</tr>
<tr>
<td width="622"><font face="Trebuchet MS">Emailadres</font></td>
<td><font face="Trebuchet MS">[email]</font></td>
</tr>
<tr>
<td width="622"><font face="Trebuchet MS">Uitschrijflink</font></td>
<td><font face="Trebuchet MS">[uitschrijflink]</font></td>
</tr>
</table>
<form method="POST" action="<? echo $_SERVER['REQUEST_URI']; ?>">
<table border="0" width="100%" id="table2">
<tr>
<td width="106"><font face="Trebuchet MS">HTML code</font></td>
<td><font face="Trebuchet MS">
<textarea rows="18" name="code" cols="74"></textarea></font></td>
</tr>
<tr>
<td height="14" width="106"></td>
<td height="14"></td>
</tr>
<tr>
<td height="14" width="106"><font face="Trebuchet MS">Versturen</font></td>
<td height="14"><font face="Trebuchet MS">
<input type="submit" value="Versturen" name="sturen"></font></td>
</tr>
</table>
</form>
<?
}
}
?>
if($link = "sturen"){
if(isset($_POST['sturen'])){
if(empty($_POST['code'])){
exit("");
}else{
$bericht = $_POST['code'];
}
$mailsql = "SElECT * FROM email";
$mailres = mysql_query($mailsql);
while($mail = mysql_fetch_array($mailres)){
$naam = $mail['naam'];
$uitschrijflink = "uitschrijven.php?email=" . $mail['email'];
$email = $mail['email'];
$bericht = ereg_replace('"', '\\"', $bericht);
$bericht = nl2br($bericht);
$naar = $mail['naam'] . " <" . $mail['email'] . ">";
require("config.php");
// HTML headers
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
// Basis headers
$headers .= 'From: ' . $naambv . ' <' . $emailbv . '>' . "\r\n";
//mailen
mail($naar, $ond, $bericht, $headers);
}
}else{
?>
<p><b><font face="Trebuchet MS">Nieuwsbrief versturen</font></b></p>
<table border="0" width="100%" id="table1">
<tr>
<td width="622"><font face="Trebuchet MS">Volledige naam</font></td>
<td><font face="Trebuchet MS">[naam] </font></td>
</tr>
<tr>
<td width="622"><font face="Trebuchet MS">Emailadres</font></td>
<td><font face="Trebuchet MS">[email]</font></td>
</tr>
<tr>
<td width="622"><font face="Trebuchet MS">Uitschrijflink</font></td>
<td><font face="Trebuchet MS">[uitschrijflink]</font></td>
</tr>
</table>
<form method="POST" action="<? echo $_SERVER['REQUEST_URI']; ?>">
<table border="0" width="100%" id="table2">
<tr>
<td width="106"><font face="Trebuchet MS">HTML code</font></td>
<td><font face="Trebuchet MS">
<textarea rows="18" name="code" cols="74"></textarea></font></td>
</tr>
<tr>
<td height="14" width="106"></td>
<td height="14"></td>
</tr>
<tr>
<td height="14" width="106"><font face="Trebuchet MS">Versturen</font></td>
<td height="14"><font face="Trebuchet MS">
<input type="submit" value="Versturen" name="sturen"></font></td>
</tr>
</table>
</form>
<?
}
}
?>
Het probleem is als ik verstuur dat hij platte tekst weergeeft.
En ook geeft die niet aan waar de email vandaan komt.
De email
Code (php)
1
2
3
4
2
3
4
Content-type: text/html; charset=iso-8859-1 From: Wessul's Nieuwsbriefsysteem <[email protected]>
<html><br /><br /> <br /><br /> <head><br /><br /> <meta http-equiv=\\\"Content-Language\\\" content=\\\"nl\\\"><br /><br /> <meta http-equiv=\\\"Content-Type\\\" content=\\\"text/html; charset=windows-1252\\\"><br /><br /> <title>New Page 2</title><br /><br /> </head><br /><br /> <br /><br /> <body><br /><br /> <br /><br /> <p>Hallo [naam] </p><br /><br /> <p>Dit is je emailadres : [email]</p><br /><br /> <p>Hier kun je uitschrijven. <a href=\\\"[uitschrijflink]\\\">Klik hier.</a></p><br /><br /> <br /><br /> </body><br /><br /> <br /><br /> </html><br /><br />
<html><br /><br /> <br /><br /> <head><br /><br /> <meta http-equiv=\\\"Content-Language\\\" content=\\\"nl\\\"><br /><br /> <meta http-equiv=\\\"Content-Type\\\" content=\\\"text/html; charset=windows-1252\\\"><br /><br /> <title>New Page 2</title><br /><br /> </head><br /><br /> <br /><br /> <body><br /><br /> <br /><br /> <p>Hallo [naam] </p><br /><br /> <p>Dit is je emailadres : [email]</p><br /><br /> <p>Hier kun je uitschrijven. <a href=\\\"[uitschrijflink]\\\">Klik hier.</a></p><br /><br /> <br /><br /> </body><br /><br /> <br /><br /> </html><br /><br />
Kan iemand me verder helpen.
Bedankt
moet
if($link == "sturen"){