Waarom krijg ik geen email binnen, gebruik Xampp als testserver.

Heb code op computer, hoe zet ik dat in toppic?

Groet,

Pieter Hofstra
XAMP beschikt niet over een juiste mailserver, volgens mij helemaal geen mailserver.
Je zal het moeten versturen via een SMTP-server.

Of iets als dit volgen om het te laten werken.
https://www.youtube.com/watch?v=TO7MfDcM-Ho

Maar ik raadt je aan een PHP Library te gebruiken om dit voor je te regelen.
PHPmailer of Swiftmailer does the job well
Bedankt voor de informatie!

Hoe kan ik de php code en het formulier laten zien in dit topic?

Ben net nieuw hier.

Groet,

Pieter Hofstra.
Pieter,

Je kan je php code plaatsen tussen speciale tags. Ze lijken een beetje op HTML.

[ code ]
[ code ]
<?php
echo 'Hello World!';
?>
[ /code ]
[ /code ]

Wel moet je de spaties weghalen die ik in de code tags heb geplaatst.
Html Code

<div id="nieuwsbriefform">
<form id="form1" name="form1" method="post" action="Nieuwsbrief.php">
<div id="formnaam"><strong>Naam:</strong></div>
<div id="formbalk1">
<input name="naam" type="text" id="naam" size="36" />
</div>
<div id="formemail"><strong>
<label for="emailadres">Emailadres:</label>
</strong></div>
<div id="formbalk2">
<input name="emailadres" type="text" id="emailadres" size="36" />
</div>
<div id="aanmelden">
<input type="image" src="Afbeeldingen/Overige/Aanmelden.jpg" alt="verzenden" value="Verzenden" />
</div>
</form>

Php Code

<?php

$naam = $_POST['naam'];
$emailadres = $_POST['emailadres'];

$to = "********@hotmail.com";
$subject = "Nieuwsbrief";
$message = "Ik wil graag de nieuwsbrief ontvangen.\n\nNaam: $naam\n\nEmailadres: $emailadres\n\n";

mail ($to, $subject,$message);

echo "Bericht is verzonden! <a href='index.html'>Klik hier</a> om terug te gaan";

?>

Zou dit moeten werken?
Wat je dus moet doen is bijvoorbeeld PHPMailer gebruiken.

--

En ik zie echt hele oude technieken, waar haal je de code vandaan of is het nog iets ouds wat ergens op een server stond?
Ik zie nooit meer <input type="image"> langskomen eigenlijk.

HTML5 heeft <button>Hier uw tekst of afbeelding</button>


<?php
/**
 * This example shows making an SMTP connection with authentication.
 */

//SMTP needs accurate times, and the PHP time zone MUST be set
//This should be done in your php.ini, but this is how to do it if you don't have access to that
date_default_timezone_set('Etc/UTC');

require '../PHPMailerAutoload.php';

//Create a new PHPMailer instance
$mail = new PHPMailer;
//Tell PHPMailer to use SMTP
$mail->isSMTP();
//Enable SMTP debugging
// 0 = off (for production use)
// 1 = client messages
// 2 = client and server messages
$mail->SMTPDebug = 2;
//Ask for HTML-friendly debug output
$mail->Debugoutput = 'html';
//Set the hostname of the mail server
$mail->Host = "mail.example.com";
//Set the SMTP port number - likely to be 25, 465 or 587
$mail->Port = 25;
//Whether to use SMTP authentication
$mail->SMTPAuth = true;
//Username to use for SMTP authentication
$mail->Username = "[email protected]";
//Password to use for SMTP authentication
$mail->Password = "yourpassword";
//Set who the message is to be sent from
$mail->setFrom('[email protected]', 'First Last');
//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]', 'John Doe');
//Set the subject line
$mail->Subject = 'PHPMailer SMTP 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(file_get_contents('contents.html'), dirname(__FILE__));
//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!";
}
?>
De nieuwere versies van XAMP bevatten ook mercury mail, een volwaardige mailserver waarmee mail zowel verzonden als ontvangen kan worden.
Dit vraagt wel om de nodige portfowardings.
...en zorgvuldige instelling! Je wilt zeker GEEN open relay voor spammers zijn waarna je ISP je deels zal blokkeren.

Reageren