| | |
Sending E-mail Within PHP
Please support our PHP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
Here is code for sending e-mail which I wrote down :
And here is the given error :
What should I do? Please help me...
•
•
•
•
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Send Mail</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<h1>SENDING MAIL</h1>
<form action="Mail.php" method="post">
<table width="200" border="0">
<tr>
<td>To Whom :</td>
<td><input type="text" name="Target" size="50" value="Someone@somenet.com"></td>
</tr>
<tr>
<td>Topic :</td>
<td><input type="text" name="Topic" size="50" value="Tryout"></td>
</tr>
<tr>
<td>Message :</td>
<td><textarea name="Message" cols="50" rows="10">Let's hope this message to be sent!</textarea></td>
</tr>
<tr>
<td>How many :</td>
<td><input type="text" name="Num" size="10" value="1"></td>
</tr>
<tr>
<td><input type="submit" name="Send" value="SEND IT!"> </td>
<td><input type="reset" name="Dont" value="Cancel"></td>
</tr>
</table>
</form>
<?
$Target =$_POST["Target"];
$Topic =$_POST["Topic"];
$Message=$_POST["Message"];
$Num =$_POST["Num"];
$Send =$_POST["Send"];
for($i=1; $i<=$Num; $i++) { $Send=mail($Target, $Topic, $Message);
if ($Send) { echo "Your mail is sent."; } else { echo "Unexpected error!"; } }
?>
</body>
</html>
•
•
•
•
Warning: mail() [function.mail]: Failed to connect to mailserver at "localhost" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set() in C:\Prog\Apache\Apache2\htdocs\EMail\Mail.php on line 40
contact your webhost as it seems they have not properly set up the mail servers in the config files, or maybe you just weren't given permission
i did a quick google search for mail servers.... why don't you give it a try:
http://www.google.com/search?hl=en&q...=Google+Search
http://www.google.com/search?hl=en&q...=Google+Search
That is all OK.
But, what is this "SENDMAIL BINARY"?
But,
•
•
•
•
For the Mail functions to be available, PHP must have access to the sendmail binary on your system during compile time. If you use another mail program, such as qmail or postfix, be sure to use the appropriate sendmail wrappers that come with them. PHP will first look for sendmail in your PATH, and then in the following: /usr/bin:/usr/sbin:/usr/etc:/etc:/usr/ucblib:/usr/lib. It's highly recommended to have sendmail available from your PATH. Also, the user that compiled PHP must have permission to access the sendmail binary.
![]() |
Similar Threads
- I need a code for sending e-mail (C#)
- Sending HTML email via PHP mail function (PHP)
- Php Mail (PHP)
- problem in sending mail form web application (ASP.NET)
- Obtain Remote Assistance by Sending an E-mail Message in Windows XP (Windows tips 'n' tweaks)
- Obtain Remote Assistance by Sending an E-mail Message in Windows XP (Windows tips 'n' tweaks)
Other Threads in the PHP Forum
- Previous Thread: Simple Case Switching for Dynamic Content
- Next Thread: Help
| Thread Tools | Search this Thread |
# .htaccess 5.2.10 access alexa apache api array beginner broken cakephp checkbox class clean clients cms code convert cron curl database date directory display dissertation dropdown dynamic echo$_get[x]changingitintovariable... email encode error fairness file folder form forms function functions google hack href htaccess html htmlspecialchars image include indentedsubcategory ip javascript joomla legislation limit link local login mail memberships menu methods multiple multipletables mysql mysqlquery network newsletters oop open passwords paypal pdf persist php provider query radio random redirect remote script search secure server sessions simple sockets source space spam sql system table tutorial upload url user variable video voteup web youtube





