Failed to connect to mailserver at "localhost" port 25
Bonjour a Tous,
j'essaye d'utiliser la fonction PHP mail(). Alors j'ai ce script:
Code:
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
|
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
<title>Contact Me</title>
</head>
<body>
<h1>Contact Me</h1>
<?php
if (isset($_POST['submitted'])) {
if (!empty($_POST['name']) && !empty($_POST['email']) && !empty($_POST['comments']) ) {
$body = "Name: {$_POST['name']}\n\nComments: {$_POST['comments']}";
$body = wordwrap($body, 70);
mail('your_email@example.com', 'Contact Form Submission', $body, "From: {$_POST['email']}");
echo '<p><em>Thank you for contacting me. I will reply some day.</em></p>';
$_POST = array();
} else {
echo '<p style="font-weight: bold; color: #C00">Please fill out the form completely.</p>';
}
}
?>
<p>Please fill out this form to contact me.</p>
<form action="email.php" method="post">
<p>Name: <input type="text" name="name" size="30" maxlength="60" value="<?php if (isset($_POST['name'])) echo $_POST['name']; ?>" /></p>
<p>Email Address: <input type="text" name="email" size="30" maxlength="80" value="<?php if (isset($_POST['email'])) echo $_POST['email']; ?>" /></p>
<p>Comments: <textarea name="comments" rows="5" cols="30"><?php if (isset($_POST['comments'])) echo $_POST['comments']; ?></textarea></p>
<p><input type="submit" name="submit" value="Send!" /></p>
<input type="hidden" name="submitted" value="TRUE" />
</form>
</body>
</html> |
Une fois que je remplis le formulaire et le valide, j'obtiens cet avertissement:
Warning: mail() [function.mail]: Failed to connect to mailserver at "localhost" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set() in D:\wamp\www\PHP-TESTS\email.php on line 25
Alors je vais donc regarder le fichier php.ini et je lis ceci:
Citation:
[mail function]
; For Win32 only.
SMTP = localhost
smtp_port = 25
; For Win32 only.
sendmail_from = you@yourdomain
Que dois faire??
Merci d'avance pour votre aide.
Billy