Ik ben bezig met een versimpelde vorm van een webshop idee, en hiervoor wil ik mailtjes gaan sturen op het moment dat iemand iets besteld heeft en voor de nieuwsbrieven. echter wil ik boven aan deze mails de header van de website hergebruiken dus ik krijg een html mail. het script dat ik momenteel heb werkt prima op een punt na, bij hotmail krijg ik geen van de afbeeldingen te zien, bij gmail wel.
<?php
include 'connect.php';
$id=$_POST['id'];
$query = 'SELECT Titel, Prijs, Status as s, Picture FROM Artikel WHERE id='.$id;
$res = mysqli_query($con, $query) or die('Er ging iets mis'. mysqli_error($con));
$row = mysqli_fetch_array($res);
if($row['s']==1){
$name = $_POST['naam'];
$lastname = $_POST['anaam'];
$email = $_POST['mail1'];
$straat = $_POST['straat'];
$postcode = $_POST['post'];
$huisnr = $_POST['huisnr'];
$test = $_POST['testhuman'];
$img = 'http://joelle.ict-port.com/'. substr($row['Picture'], 6);
echo $img;
$message = '
<!DOCTYPE html>
<html>
<head>
<title>
Uw bestelling
</title>
<style>
body{
background-color:e17dec;
}
#container{
margin: 0 auto;
width: 800px;
}
#gegevens{
float: left;
margin-left: 80px;
width: 400px;
}
#foto{
float: left;
width: 300px;
}
</style>
</head>
<body>
<div id="container">
<img src="http://joelle.ict-port.com/img/logo.png" height="200" alt="logo" width="800" /><br />
<br />
<center>
Bedankt voor uw bestelling! controleer a.u.b uw gegevens.<br />
Mochten deze onjuist zijn neem zo snel mogelijk contact met ons op onder vermelding van het Bestellings ID<br />
</center>
<div id="gegevens">
<table>
<tr>
<td>
Bestellings ID:
</td>
<td>
'.$id.'
</td>
</tr>
<tr>
<td>
Artikel naam:
</td>
<td>
'.$row['Titel'].'
</td>
</tr>
<tr>
<td>
Naam:
</td>
<td>
'.$name.'
</td>
</tr>
<tr>
<td>
Achternaam klant:
</td>
<td>
'.$lastname.'
</td>
</tr>
<tr>
<td>
Email klant:
</td>
<td>
'.$email.'
</td>
</tr>
<tr>
<td>
Straat klant:
</td>
<td>
'.$straat.'
</td>
</tr>
<tr>
<td>
Huisnummer klant:
</td>
<td>
'.$huisnr.'
</td>
</tr>
<tr>
<td>
Postcode klant:
</td>
<td>
'.$postcode.'
</td>
</tr>
<tr>
<td>
Prijs:
</td>
<td>
'.$row['Prijs'].'
</td>
</tr>
</table>
</div>
<div id="foto">
<img src="'.$img.'" alt="Jouw aankoop" height="200" width="200" />
</div>
</div>
</body>
</html>
';
if($test=="human"){
$to = $email;
$errormail = '[email protected]';
$website_naam = 'joelle.ict-port.com';
$html = true;
if(empty($to) || empty($email) || empty($message)){
echo 'one of the variables is not set';
}
else{
$headers = 'From: ' . '[email protected]' . ' <' . '[email protected]' . '>' . "\r\n";
$headers .= 'Reply-To: ' . '[email protected]' . ' <' . '[email protected]' . '>' . "\r\n";
$headers .= 'Return-Path: Mail-Error <' . $errormail . '>' . "\r\n";
$headers .= 'X-Mailer: PHP/' . phpversion() . "\r\n";
$headers .= 'X-Priority: Normal' . "\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);
header('Location: ../index.php');
}
}
else if($row['s']==2){
echo 'Dit artikel is gereserveerd.</br>';
}
else{
echo 'Dit artikel is niet gevonden.<br />';
}
}
else if($test=="robot"){
echo "You look like a spambot";
}
else{
echo "can't find antispam test";
}
?>