PDA

View Full Version : PHP Mail() problem !



scaryhunter
23 Aug 2009, 06:01 AM
Hi everyone !
I'm a " newbie ", i've reached chapter 3 in my book that talks about PHP mail()
I wrote this code


<?php
$name = $_POST['name'];
$email = $_POST['email'];
$feedback = $_POST['feedback'];

$toaddress = "Something@yahoo.com";
$subject = "FeedBack from website";

$mailcontent = "Customer name:".$name."\n";
"Customer E-mail:".$email."\n";
"Customer Comments:".$feedback."\n";

$fromaddress = "From : Something@yahoo.com";

mail($toaddress, $subject, $mailcontent, $fromaddress);
?>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Bob's Auto Part - Feedback Submitted</title>
</head>
<body>
<h1>Feedback Submitted</h1>
<p>Your feedback has been sent.</p>
</body>
</html>


Okay i went to php.ini and changed the SMTP, SMTP_port and Send_From...I dont know why it says" Failed to send, check SMTP and SMTP_port.
I think because i want to send e-mail from Yahoo , i should add Username and Password..But i don't know how.

Please if you know how to add username and password, i'll appreciate it so much.

is_numeric
01 Sep 2009, 01:27 AM
You need to upload the script to a server which supports PHP mail

Commercial hosting have SMTP servers running in order to push the email out to its destination. If you want to send mail from your machine {local environment} then you need an SMTP server installed