hi friends.
i have a problem with execution of the mail() of php
its not sending messages to the specified mails.
i need help to work it out so that i can complete the topic
thanks in advance

Recommended Answers

All 16 Replies

What did you try?

<html>
<body>

<?php
if (isset($_REQUEST['email']))
//if "email" is filled out, send email
  {
  //send email
  $email = $_REQUEST['email'] ;
  $subject = $_REQUEST['subject'] ;
  $message = $_REQUEST['message'] ;
  mail("someone@example.com", "Subject: $subject",
  $message, "From: $email" );
  echo "Thank you for using our mail form";
  }
else
//if "email" is not filled out, display the form
  {
  echo "<form method='post' action='mailform.php'>
  Email: <input name='email' type='text' /><br />
  Subject: <input name='subject' type='text' /><br />
  Message:<br />
  <textarea name='message' rows='15' cols='40'>
  </textarea><br />
  <input type='submit' />
  </form>";
  }
?>

</body>
</html>

and i had wrote my mail instead of that someone@example.com

but i didnt recieve the message.
please let me know the reason for the incorrect output

Maybe the mail settings in PHP are not configured correctly? Perhaps you can find something wrong in phpinfo(); (somewhere in phpinfo(13); , probably).

oh then what is the thing i can do now?

Are you on a shared host? Perhaps you can find some information on email if you call that function, and check if it's correct?

sir i use wamp server
and i have account in free webhosting, i tried that too
but its not delivering the message

Are you running this code in localhost?

i am running this code using wampserver

sir i am not having that php.ini file to see its content
what should i do now..
please dont feel bad of asking so many times and hope i will be helped

If you're running your own WAMP, it should be very easy to edit php.ini. If not, contact the one that is running the server.

i am running my own wamp
its installed by me itself
and is it that we have to mention any local host while at the time of installing??

What do you mean? To edit php.ini, just click on the WAMP icon and there should be something that says "Edit php.ini".

i have been asked SMTP and email during the time of installation
what should i fill in them
default for smtp is localhost and the one for email is you@yourdomain
any changes is to be made?

Well, unless you want to install your own mail server, you could enter you gmail details or something.

yeah i did it
now the things i have to change?

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.