O'Reilly Forums: Failed To Connect To Mailserver At "localhost" Port 25 - O'Reilly Forums

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Failed To Connect To Mailserver At "localhost" Port 25 Problem from page 51

#1 User is offline   Shua_31002 

  • Active Member
  • PipPip
  • Group: Members
  • Posts: 19
  • Joined: 04-January 12

Posted 04 January 2012 - 09:27 AM

Im having problems getting the email to send to the target address. Here is the code from page 51, that appears to my eyes to be correct and no errors made, yet i get a error when submitting form, see below the code for the error that is generated.

code as follows:

<html>
<head>
<title>Aliens Abducted Me - Report an Abduction</title>
</head>
<body>
<h2>Aliens Abducted Me - Report an Abduction</h2>

<?php
$name = $_POST['firstname'] . ' ' . $_POST['lastname'];
$when_it_happened=$_POST['whenithappened'];
$how_long=$_POST['howlong'];
$alien_description=$_POST['aliendescription'];
$fang_spotted=$_POST['fangspotted'];
$email=$_POST['email'];
$how_many=$_POST['howmany'];
$what_they_did=$_POST['whattheydid'];
$other=$_POST['other'];

$to = 'graphicinspiration@gmail.com';
$subject = 'Aliens Abducted Me - Abduction Report';
$msg = "$name was abducted $when_it_happened and was gone for $how_long. \n" .
"Number of aliens: $how_many\n" .
"Alien description: $alien_description\n" .
"What they did: $what_they_did\n" .
"Fang spotted: $fang_spotted\n" .
"Other comments: $other";
mail($to, $subject, $msg, 'From:' . $email);

echo 'Thanks for sumbitting the form.<br/>';
echo 'You were abducted ' . $when_it_happened;
echo ' and were gone for ' . $how_long.'<br/>';
echo 'Number of aliens: ' . $how_many.'<br/>';
echo 'Describe them: ' . $alien_description.'<br/>';
echo 'The aliens did this: ' . $what_they_did.'<br/>';
echo 'Was Fang there? ' . $fang_spotted.'<br/>';
echo 'Other comments: ' . $other.'<br/>';
echo 'Your email address is ' .$email;

?>

</body>
</html>

Error received when submitting the form:

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:\wamp\www\Testsite\report.php on line 27


I'm running WAMP as a local server, i looked in the php.ini files there are 2, and it appears that the smtp settings and port are set correctly and to port 25.

Help?

Joshua
0

#2 User is offline   lemuel 

  • Super Veteran Member
  • PipPipPipPipPipPipPipPipPipPipPip
  • Group: Members
  • Posts: 573
  • Joined: 13-April 09

Posted 04 January 2012 - 09:58 AM

If your internet provider requires a userid/password for sending email (and most do) then plain WAMP won't work for you. XAMPP contains a mail server program. Most people find it easier to just use one of the low-cost site hosting servers for php/mysql learning. See:
http://forums.oreill...dpost__p__12626
0

#3 User is offline   Shua_31002 

  • Active Member
  • PipPip
  • Group: Members
  • Posts: 19
  • Joined: 04-January 12

Posted 04 January 2012 - 10:20 AM

View Postlemuel, on 04 January 2012 - 09:58 AM, said:

If your internet provider requires a userid/password for sending email (and most do) then plain WAMP won't work for you. XAMPP contains a mail server program. Most people find it easier to just use one of the low-cost site hosting servers for php/mysql learning. See:
http://forums.oreill...dpost__p__12626



XAMPP? is this a program like WAMP?

back when i was taking a php class in college we had an exercise similar to this and the mail() function worked fine using MAMP on my macbook pro.
0

#4 User is offline   lemuel 

  • Super Veteran Member
  • PipPipPipPipPipPipPipPipPipPipPip
  • Group: Members
  • Posts: 573
  • Joined: 13-April 09

Posted 04 January 2012 - 10:32 AM

You were using MAMP Pro, which also contains a mail server. WAMP does not.
0

#5 User is offline   Shua_31002 

  • Active Member
  • PipPip
  • Group: Members
  • Posts: 19
  • Joined: 04-January 12

Posted 04 January 2012 - 01:50 PM

on the subject of MAMP.. i just got home from work dealing with this issue all day.. not to mention that WAMP wont allow me into myphpadmin panel.. (another issue altogether)

anyhow.. i get home, fire up my macbook, fire up MAMP and ran the script. Everything is working fine, no line errors... however i didnt get the email in my inbox for the email address that i assigned to send in php script. So not sure why the email didnt come through, but at least i didnt get that mail() function on port 25 error.

Thanks for you speedy replies by the way.

Joshua
0

#6 User is offline   lemuel 

  • Super Veteran Member
  • PipPipPipPipPipPipPipPipPipPipPip
  • Group: Members
  • Posts: 573
  • Joined: 13-April 09

Posted 04 January 2012 - 09:31 PM

Don't have a Mac and never used MAMP so can't help you on that one.
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users