What’s wrong with this…? I don’t get an email back…
Also, does the from address have to be a real address? If I run this on a computer that doesn’t have Outlook Express, will it not work? How can I make it work on computers like that?
<html>
<head>
<title>Test php</title>
</head>
<?php
$to = "asjjohnson127@aim.com";
$subject = "testing php emailing";
$from = "asjjohnson127@gmail.com";
$headers = "From: $from";
$message = "Your username is " . $_POST['username'];
if (mail($to,$subject,$message,$headers))
echo "Mail Sent.";
else
echo "Problem with mail.";
?>
<body>
</body>
</html>
If your running the script on a local server you’ll need to configure the php.ini look for the following and change to your ISP’s SMTP server.
You code will send email, its an issue with your SMTP configuration.
Another way to do it is set SMTP to localhost then use a SMTP service http://www.softstack.com/freesmtp.html usually runs on port 25 If I remember correctly.