Click here to Skip to main content
15,895,667 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
I made a html page to send an email with php an set method with action an this is my php code:
PHP
<?php
    $name=$_POST['name'];
    $email=$_POST['email'];
    $feedback=$_POST['feedback'];
    $toaddress='test@yahoo.com';
    $subject='Feedback from web site';
    $mailcontent='Customer name: '.$name."\n"
    .'Customer Email: '.$email."\n"
    .'customer content: '."\n".$feedback."\n";
    $fromaddress='From: test@yahoo.com';
    mail($toaddress,$subject,$mailcontent,$fromaddress);
?>

but when I want to run this I cant send email and I see this message:
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:\xampp\htdocs\chapter1\feedback.php on line 13
what is the problem please help me
Posted

1 solution

It looks like your system is not configured with sending e-mail via SMTP. This PHP function is made in assumption it is fully set up. Web hosting provider usually have it setup for your.

—SA
 
Share this answer
 
Comments
sadegh_sh 19-Jun-11 16:21pm    
how I can configure with sending email via SMTP
my system has xampp
Sergey Alexandrovich Kryukov 20-Jun-11 2:08am    
This is system-dependent; and there are different solutions for the same system. I don't know what is xampp. These questions are not about programming but about using available software and OS, address to documentation of the software (which is may be not installed).
--SA

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900