offline using html-form to send email

Problems with the Windows version of XAMPP, questions, comments, and anything related.

offline using html-form to send email

Postby houtkamp » 27. November 2011 18:03

Hello,

I am trying to send a message from an html-form to my email address.
This the html form:

Code: Select all
<html>
<head>
   <title>Mailformulier</title>
</head>
<body>
<form action="php/mailform.php" method="post">
<input type="hidden" name="to" value="houtkamp@localhost">
<input type="hidden" name="subject" value="mail van uw website">
<input type="hidden" name="redirect"
   value=/webshop/www/thanks.html>
Naam: <input type="text" name="naam"><br>
E-mail: <input type="text" name="mailadres"><br>
Uw reactie: <textarea cols="30" rows="4" name="reactie"></textarea>
<input type="submit" value="verzenden">
</form>
</body>
</html>


I use this php script with it:

Code: Select all
<?php
ini_set("SMTP", "localhost");
ini_set("smtp_port", 25);
ini_set ("sendmail_from", "houtkamp@localhost");
$to = $_POST["to"];
$subject = $_POST["subject"];
$redirect = $_POST["redirect"];
if (!$to) { // Bevat to geen waarde?
   echo "U heeft geen ontvanger opgegeven!";
   exit;
}

reset($_POST); // Zet de array pointer op 0, begin bij het begin
while($postvar = each($_POST)) {
   $varnaam = $postvar['key'];
   $varinhoud = $postvar['value'];
   $boodschap .= $varnaam."=".$varinhoud."\n"; // Boodschap bevat
}

mail($to, $subject, $boodschap); // stuur de mail  (aan, onderwerp, mail)

if (isset($redirect)) {  // Bevat redirect een waarde?
   header("location: $redirect");
}

?>




What do I have to change so I can receive an email, on this email address: houtkamp@localhost ?
I'd like to use Windows Live Mail. So Included in this question also lies the question for me:
What should the account settings be in this case?

I'm using this study book about PHP5 (the complete work). Because they warn you about not using
xampp life, I don't want internet connection.

Thank you in advance for your efforts in helping me out.

Yours truly,
Roy
houtkamp
 
Posts: 1
Joined: 27. November 2011 16:59
Operating System: win7 home premium sp1 64bit

Re: offline using html-form to send email

Postby JonB » 28. November 2011 20:42

I 'think' the only way to receive mail as 'user.whatever@localhost' is to set up a local mailserver such as Mercury Mail (included with XAMPP) or hMail (also free, but simpler to configure). You would then make the domain name 'localhost'.

I also suspect that only an e-mail client (like thunderbird) will be able to pickup that mail. That would be a POP3 pickup. You would probably also need a 'mail' host assignment in the Hosts file (such as 127.0.0.1 mail.localhost)

reason: In this case, localhost is effectively a 'local domain' and cannot be resolved to a remote IP without breaking XAMPP.


Good Luck
8)
User avatar
JonB
AF Moderator
 
Posts: 3210
Joined: 12. April 2010 16:41
Location: Land of the Blazing Sun
Operating System: Windows XP/7 - Fedora 15 1.7.7


Return to XAMPP for Windows

Who is online

Users browsing this forum: No registered users and 73 guests