Jump to content

Php mail function and which ports to use?


dragonking6v

Recommended Posts

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.

[code]<?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");
?>[/code]
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
Link to comment
Share on other sites

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.
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.