Page 1 of 6 123 ... LastLast
Results 1 to 10 of 55

Thread: PHP SMTP_port. . . huh?

  1. #1
    Join Date
    Jan 2007
    Posts
    629
    Thanks
    10
    Thanked 28 Times in 28 Posts

    Default PHP SMTP_port. . . huh?

    Here is the type of error I am getting:

    Warning: mail() [function.mail]: Failed to connect to mailserver at "MyDomain" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set() in PATH on line 37

    So what should it be? I am running an XP server with PHP5. Do I need some kind of emailing client-- such as in the case of FTP? Or do I have a setting wrong? What am I suppose to do?

    BTW: I am using the ini_set() function to control the settings for now. I don't think that makes a differense, but I thought I would mention it.
    --Jas
    function GreatMinds(){ return "Think Like Jas"; }
    I'm gone for a while, but in the meantime: Try using my FTP script | Fight Bot Form Submissions

  2. #2
    Join Date
    Sep 2006
    Location
    St. George, UT
    Posts
    2,769
    Thanks
    3
    Thanked 157 Times in 155 Posts

    Default

    You have to have a functioning mail server installed in order to send emails on your home server. I recommend hMailServer as it is really easy to use and is free.

    Hope this helps.
    "Computer games don't affect kids; I mean if Pac-Man affected us as kids, we'd all be running around in darkened rooms, munching magic pills and listening to repetitive electronic music." - Kristian Wilson, Nintendo, Inc, 1989
    TheUnlimitedHost | The Testing Site | Southern Utah Web Hosting and Design

  3. #3
    Join Date
    Jan 2007
    Posts
    629
    Thanks
    10
    Thanked 28 Times in 28 Posts

    Default

    Thanks for the quick reply. Now I am getting this:


    Warning: mail() [function.mail]: SMTP server response: 550 The address is not valid. in PATH on line 37

    What does that mean?

    BTW: I am sending an email to the user-- a registry conformation.
    Last edited by Jas; 12-06-2007 at 10:49 PM.
    --Jas
    function GreatMinds(){ return "Think Like Jas"; }
    I'm gone for a while, but in the meantime: Try using my FTP script | Fight Bot Form Submissions

  4. #4
    Join Date
    Jan 2007
    Posts
    629
    Thanks
    10
    Thanked 28 Times in 28 Posts

    Default

    Ok, so now here is what's happening. The email "sends," but when I check my account, nothing is there.

    Code:
    <?php
    
    function notify_user($email){
    
    ini_set('smtp_port',25);
    ini_set('SMTP','www.mysite.com');
    ini_set('sendmail_from','admin@mysite.com');
    
    $to  = $email;
    
    $subject = 'www.mysite.com Application';
    
    $message = 'Your Application Was Accepted!';
    
    // To send HTML mail, the Content-type header must be set
    $headers  = 'MIME-Version: 1.0' . "\r\n";
    $headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
    
    // Additional headers
    $headers .= 'From: Admin <admin@mysite.com>' . "\r\n";
    
    // Mail it
    echo mail($to, $subject, $message, $headers);
    
    }
    
    notify_user('me@hotmail.com');
    ?>
    --Jas
    function GreatMinds(){ return "Think Like Jas"; }
    I'm gone for a while, but in the meantime: Try using my FTP script | Fight Bot Form Submissions

  5. #5
    Join Date
    Sep 2006
    Location
    St. George, UT
    Posts
    2,769
    Thanks
    3
    Thanked 157 Times in 155 Posts

    Default

    Question, why are you echoing the mail function?

    Code:
    echo mail($to, $subject, $message, $headers);
    "Computer games don't affect kids; I mean if Pac-Man affected us as kids, we'd all be running around in darkened rooms, munching magic pills and listening to repetitive electronic music." - Kristian Wilson, Nintendo, Inc, 1989
    TheUnlimitedHost | The Testing Site | Southern Utah Web Hosting and Design

  6. #6
    Join Date
    Jan 2007
    Posts
    629
    Thanks
    10
    Thanked 28 Times in 28 Posts

    Default

    To see if it sent. It is a test srcipt for now, so the resulting 1 or nothing doen't matter. (It prints 1 if it sent, nothing if it didn't.)
    It is sending, or it says it is, but the message is not there when I check my email.
    Last edited by Jas; 12-09-2007 at 12:44 AM.
    --Jas
    function GreatMinds(){ return "Think Like Jas"; }
    I'm gone for a while, but in the meantime: Try using my FTP script | Fight Bot Form Submissions

  7. #7
    Join Date
    Sep 2006
    Location
    St. George, UT
    Posts
    2,769
    Thanks
    3
    Thanked 157 Times in 155 Posts

    Default

    Well, the script itself works. You may want to check if you have the permission to use the mail server that you set in the ini_set functions at the top of the script. Other than that, you will want to make sure that the server does in fact have a mail server installed.

    Hope this helps.
    "Computer games don't affect kids; I mean if Pac-Man affected us as kids, we'd all be running around in darkened rooms, munching magic pills and listening to repetitive electronic music." - Kristian Wilson, Nintendo, Inc, 1989
    TheUnlimitedHost | The Testing Site | Southern Utah Web Hosting and Design

  8. #8
    Join Date
    Jan 2007
    Posts
    629
    Thanks
    10
    Thanked 28 Times in 28 Posts

    Default

    I run the server on my comp (win XP and WAMP with your mailing program)
    --Jas
    function GreatMinds(){ return "Think Like Jas"; }
    I'm gone for a while, but in the meantime: Try using my FTP script | Fight Bot Form Submissions

  9. #9
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    You need to set an appropriate SMTP server and port in your config.
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  10. #10
    Join Date
    Jan 2007
    Posts
    629
    Thanks
    10
    Thanked 28 Times in 28 Posts

    Default

    How will that change anything? I am setting it with ini_set() for now, so that I can make changes until I get it right.
    EDIT: if you mean something besides www.MySite.com, I am not really using that. I changed it for the post. . .
    EDIT2: Hey! www.MySite.com really exists lol.

    The message that I am trying to send shows up in hmailserver under the "undelivered messages" tab.
    --Jas
    function GreatMinds(){ return "Think Like Jas"; }
    I'm gone for a while, but in the meantime: Try using my FTP script | Fight Bot Form Submissions

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •