Hello friends i'm new in php programming,
i'm using wampserver with php5.3.5 , but it shows error on this code

<?php
$to = "bkstha2010@gmail.com";
$subject = "Test mail";
$message = "Hello! This is a simple email message.";
$from = "someonels@example.com";
mail($to,$subject,$message,$headers);
echo "Mail Sent.";
?>

as well as while executing html combined code.
Can someone help me?

Recommended Answers

All 5 Replies

If you are testing this page in local then it won't work.
You need smtp setting for sending email.
For other error post the error you are getting.

post the error message tha you got

Member Avatar for diafol

If you've got something like mercury mail, turn it on. As mnentioned you need a smtp server.

Member Avatar for Zagga

Hi bishaw,

As mentioned above, you either need an SMTP server (like Mercury) enabled, or you can try using PEAR (See my comment on this post)

I think your SMTP server is not configured.....configure it then only you can send mail...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.