943,970 Members | Top Members by Rank

Ad:
  • PHP Discussion Thread
  • Unsolved
  • Views: 3871
  • PHP RSS
May 23rd, 2005
0

Sending E-mail Within PHP

Expand Post »
Here is code for sending e-mail which I wrote down :
Quote ...
<!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>
And here is the given error :
Quote ...
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
What should I do? Please help me...
Similar Threads
Reputation Points: 13
Solved Threads: 1
Junior Poster in Training
AhmedHan is offline Offline
71 posts
since Apr 2005
May 23rd, 2005
0

Re: Sending E-mail Within PHP

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
Reputation Points: 13
Solved Threads: 4
Posting Whiz
paradox814 is offline Offline
351 posts
since Oct 2004
May 24th, 2005
0

Re: Sending E-mail Within PHP

Sorry that I have forgot to write that my page is not on a web server. It is on my computer.
The PHP script is being run on "Apache 2.0 - PHP 5 - WinXP" platform.
Reputation Points: 13
Solved Threads: 1
Junior Poster in Training
AhmedHan is offline Offline
71 posts
since Apr 2005
May 26th, 2005
0

Re: Sending E-mail Within PHP

so how will that process den ? since u didn't put up ur pages in ur web server ?
Reputation Points: 10
Solved Threads: 0
Newbie Poster
developerszone is offline Offline
4 posts
since May 2005
May 26th, 2005
0

Re: Sending E-mail Within PHP

you will have to setup a mail server, and point it there
Reputation Points: 13
Solved Threads: 4
Posting Whiz
paradox814 is offline Offline
351 posts
since Oct 2004
May 26th, 2005
0

Re: Sending E-mail Within PHP

So, how can I install a mail server to my computer. Isn't there a way for sending mail without setting the page onto an external (real) web server?
Reputation Points: 13
Solved Threads: 1
Junior Poster in Training
AhmedHan is offline Offline
71 posts
since Apr 2005
May 26th, 2005
0

Re: Sending E-mail Within PHP

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
Reputation Points: 13
Solved Threads: 4
Posting Whiz
paradox814 is offline Offline
351 posts
since Oct 2004
May 26th, 2005
0

Sendmail Binary

That is all OK.

But,
Quote ...
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.
what is this "SENDMAIL BINARY"?
Reputation Points: 13
Solved Threads: 1
Junior Poster in Training
AhmedHan is offline Offline
71 posts
since Apr 2005

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in PHP Forum Timeline: Simple Case Switching for Dynamic Content
Next Thread in PHP Forum Timeline: Help





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC