I am also having problems in mail(). My php.ini values are (sendmail_from:"no value", SMTP:"localhost", smtp_port:"25"), my code is very simple and is as below -

<html>
<body>

<?php
if (isset($_REQUEST['email'])) 
  {
  //send email
  $email = $_REQUEST['email'] ; 
  $subject = $_REQUEST['subject'] ;
  $message = $_REQUEST['message'] ;
  if (mail( "kathie_hkg@yahoo.com", "Subject: $subject", $message, "From: $email" )) {
		echo("<p>Message successfully sent!</p>");
	} else {
		echo("<p>Message delivery failed...</p>");
	}
} else {
  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>

It always gives me "Message delivery failed...". Pls help. Thanks.

Recommended Answers

All 3 Replies

You probably don't have sendmail set up. windows? Try a program called stunnel.

it is because you haven't set the SMTP to yahoo. Since you try to send to XXX@yahoo.com you have to configure the SMTP and Port to yahoo setting

mark the thread as solved ,if you are satisfied with the solutions provided

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.