Jump to content


Photo

Php mail function and which ports to use?


  • Please log in to reply
1 reply to this topic

#1 dragonking6v

dragonking6v
  • New Members
  • Pip
  • Newbie
  • 1 posts

Posted 04 March 2006 - 12:48 AM

WARNING-I tried to be thorough, but you may be able to understand what I'm saying without having to read all this

I'm using php 5 and apache 1.3.31 I think. Anyway I bought a php book to help me learn this faster, and I've installed php mysql and apache exactly as they said and I have tested each one and each is working as it should.

<?php
    $to = "pretzelking@gmail.com";
    $sub = "SUBJECT";
    $msg = "This is where my message goes...";
    $mail = mail ( $to, $sub, $msg )
    or die( "Sorry - Didn't work right");
    echo("It worked");
?>
I wrote this using an example from the book. The format for the mail fuction is:
mail( to, subject, message );
Now heres what I don't get. When I try localhost/mail.php (where it is saved) I get the die message.

So, I try running it through the php editor that I am using, i.e. PHP Designer 2006. It tells me to check the settings for SMTP and smtp_port in php.ini

I open up php.ini in the WINDOWS folder and here's what I have for SMTP and smtp_port:
SMTP = localhost
smtp_port = 25

Note that neither of these have a semi-colon in front of them (which would exclude them).

Another thing that raised a red flag in my mind is in my debug preferences in PHP Designer It has a little box that says localhost (I believe) and then next to it it says port
Under localhost I put the correct location for the apache htdocs folder and under port it automatically put 80 in their. I'm not sure if this should be 25 like my smtp_port setting is or whatever.

Anyway in I round-about way I would just like to know if smtp_port = 25 is ok, or if there is a way to check which port I should use. Also should my settings in debug mode in PHP Designer be 25, 80, or something else?

Thanks a lot for your time :-D

#2 Kris

Kris
  • Staff Alumni
  • Advanced Member
  • 2,755 posts
  • LocationThe Internet

Posted 05 March 2006 - 11:01 AM

I think a better question would be, do you have a mail server installed on your system. As SMTP is pointing at localhost, I would assume it is looking for a mailserver on your local machine to send the email through... If not, install one or point it to a mail server online somewhere.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users