mail via PHP
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
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
$to = "********@hotmail.com";
$subject = "bestelling";
$message = '
<html>
<head>
<title>Bestelling</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="25%">naam:</td>
<td width="75%"><?php echo $_POST['voornaam'];?>, <?php echo $_POST['naam']; ?></td>
</tr>
<tr>
<td align="left" valign="top">adres:</td>
<td><?php echo $_POST['straat']; ?><?php echo $_POST['nr']; ?><?php echo $_POST['bus']; ?><br>
<?php echo $_POST['postcode']; ?> <?php echo $_POST['plaats']; ?> </td>
</tr>
<tr>
<td>telnr:</td>
<td><?php echo $_POST['telnr']; ?></td>
</tr>
<tr>
<td>emailadres:</td>
<td><?php echo $_POST['afzender']; ?></td>
</tr>
</table>
<p><?php echo $_POST['gegevens']; ?><br>
---------------------------------------------- <br>
<?php echo $_POST['bestelling']; ?></p>
</body>
</html>
';
$headers = "MIME-Version: 1.0\r\n";
$headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
$headers .= "To: Bart <*******@hotmail.com>\r\n";
$headers .= "From: $afzender <$afzender\r\n";
mail($to, $subject, $message, $headers);
?>
$to = "********@hotmail.com";
$subject = "bestelling";
$message = '
<html>
<head>
<title>Bestelling</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="25%">naam:</td>
<td width="75%"><?php echo $_POST['voornaam'];?>, <?php echo $_POST['naam']; ?></td>
</tr>
<tr>
<td align="left" valign="top">adres:</td>
<td><?php echo $_POST['straat']; ?><?php echo $_POST['nr']; ?><?php echo $_POST['bus']; ?><br>
<?php echo $_POST['postcode']; ?> <?php echo $_POST['plaats']; ?> </td>
</tr>
<tr>
<td>telnr:</td>
<td><?php echo $_POST['telnr']; ?></td>
</tr>
<tr>
<td>emailadres:</td>
<td><?php echo $_POST['afzender']; ?></td>
</tr>
</table>
<p><?php echo $_POST['gegevens']; ?><br>
---------------------------------------------- <br>
<?php echo $_POST['bestelling']; ?></p>
</body>
</html>
';
$headers = "MIME-Version: 1.0\r\n";
$headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
$headers .= "To: Bart <*******@hotmail.com>\r\n";
$headers .= "From: $afzender <$afzender\r\n";
mail($to, $subject, $message, $headers);
?>
dit is mijn code voor een bestelling te plaatsen op onze website. Het is dus de bedoeling om de bestelling door te mailen naar mijn email, maar dit lukt niet. De inhoud zou dus zonder HTML moeten zijn, maar de headers zou ik het liefst bijhouden, weet er iemand raad svp?
Code (php)
1
2
3
4
5
6
7
2
3
4
5
6
7
<?
$headers = "From: $afzender <$afzender>\r\n";
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
mail($to, subject, $message, $headers);
?>
$headers = "From: $afzender <$afzender>\r\n";
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
mail($to, subject, $message, $headers);
?>
that'll work :)
kga het strak eens proberen en als het niet lukt, laat ik wel een berichtje achter :)
thanx
np.. :)
hieronder zie je de code die ik dus gebruik nu:
Code (php)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
<?php
$to = "[email protected]";
$subject = "bestelling";
$message = '
$gegevens
$bestelling';
$headers = "From: $afzender <$afzender>\r\n";
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
mail($to, subject, $message, $headers);
?>
$to = "[email protected]";
$subject = "bestelling";
$message = '
$gegevens
$bestelling';
$headers = "From: $afzender <$afzender>\r\n";
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
mail($to, subject, $message, $headers);
?>