Hallo allen,

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";
	  }
?>
Het advies wat elke programmeur mij heeft gegeven: gebruik swiftmailer of PHPmailer. Ikzelf gebruik PHPmailer waardoor je in maximaal 10 regels je mail kan samenstellen :)

Helaas heb ik geen idee waarom je image het niet doet in Hotmail
@donny ik heb weleens van phpmailer gehoord nog nooit mee gewerkt, echter probeer ik altijd afhankelijkheid van andere packages te voorkomen....
Ik denk dat ik namens iedereen spreek als ik zeg: "waarom zou je het wiel opnieuw uitvinden?"...

Waarom wil je 50 regels code schrijven, als je er al met 10 bent?
Je gebruikt headers die kenmerkend zijn voor spam: From noreply@ en Reply to noreply@. Dat laatste is ook niet bepaald logisch: reply to noreply...
@ward, dat is misschien wel handig om aan te passen ja...
Niet elke webmaildienst laat nog afbeeldingen zien. Dit volgens mij uit veiligheidsoverwegingen.
Ook bij Gmail heb ik met enige regelmaat dat ik niet de afbeelingen zien (kan ze wel opvragen).
Ook in Outlook en Thunderbird worden afbeeldingen niet (altijd) automatisch getoond.
Gmail toont de afbeeldingen sinds kort via een eigen proxy.
ik heb met gmail totaal geen problemen.... echter alleen met hotmail...
ik heb de phpmailer class geimplementeerd en heb nu dit:

<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title>PHPMailer - mail() test</title>
</head>
<body>
<?php
require 'mail/PHPMailerAutoload.php';

	$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);
	$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>
	';

//Create a new PHPMailer instance
$mail = new PHPMailer();
//Set who the message is to be sent from
$mail->setFrom('[email protected]', 'Bestel joelle.ict-port.com');
//Set an alternative reply-to address
//$mail->addReplyTo('[email protected]', 'First Last');
//Set who the message is to be sent to
$mail->addAddress('[email protected]', 'cyvan oort');
//Set the subject line
$mail->Subject = 'PHPMailer mail() test';
//Read an HTML message body from an external file, convert referenced images to embedded,
//convert HTML into a basic plain-text alternative body
$mail->msgHTML($message);
//Replace the plain text body with one created manually
$mail->AltBody = 'This is a plain-text message body';
//Attach an image file
$mail->addAttachment('images/phpmailer_mini.png');

//send the message, check for errors
if (!$mail->send()) {
    echo "Mailer Error: " . $mail->ErrorInfo;
} else {
    echo "Message sent!";
}
?>
</body>
</html>


en heb exact hetzelfde probleem, gmail ziet hem wel en hotmail niet :S
Je zou de afbeelding ook mee kunnen sturen, of inline in de html verpakken.
Mits je mail dan niet vele MB groot wordt
Mogelijk sta je bij hotmail in de trust lijst, maar ik kan me goed voorstellen dat ze allemaal geen links van externe bronnen automatisch tonen.
Het makkelijkste vind ik om de afbeeldingen mee te sturen.
Ook zie ik dat je HTML niet aan staat, maar misschien dat dit default al is.


<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title>PHPMailer - mail() test</title>
</head>
<body>
<?php
require 'mail/PHPMailerAutoload.php';

    $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);
    $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">
                    <!-- Inline image weergeven -->
	            <img src="cid:logoimg" 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">
                        <!-- Inline image weergeven -->
                        <img src="cid:aankoop" alt="Jouw aankoop" height="200" width="200" />
                    </div>
                </div>
            </body>
        </html>
    ';

//Create a new PHPMailer instance
$mail = new PHPMailer();
//Set who the message is to be sent from
$mail->setFrom('*', 'Bestel *');
//Set an alternative reply-to address
//$mail->addReplyTo('[email protected]', 'First Last');
//Set who the message is to be sent to
$mail->addAddress('*', '*');
//Set the subject line
$mail->Subject = 'PHPMailer mail() test';
//Read an HTML message body from an external file, convert referenced images to embedded,
//convert HTML into a basic plain-text alternative body
$mail->msgHTML($message);
//Replace the plain text body with one created manually
$mail->AltBody = 'This is a plain-text message body';
//Attach an image file
$mail->addAttachment('images/phpmailer_mini.png');

$mail->IsHTML(true); // HTML
$mail->AddEmbeddedImage(__DIR__ . '/img/logo.png' , 'logoimg'); // Inline image meesturen
$mail->AddEmbeddedImage(__DIR__ . '/' . $img, 'aankoop');

//send the message, check for errors
if (!$mail->send()) {
    echo "Mailer Error: " . $mail->ErrorInfo;
} else {
    echo "Message sent!";
}
?>
</body>
</html>

Reageren