mail() Function and localhost

Discussion in 'PHP' started by jeremyhowell, Nov 25, 2010.

  1. #1
    Im trying to test my email form for my web site on my computer, and I get an error when trying to use the mail function. Here it is, I understand perfectly what it is saying, but I have no idea what I should be editing in php.ini and will I have this problem when I upload it to my server?

    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:\xampp\htdocs\xampp\contact.php on line 9
    
    Code (markup):

     
    jeremyhowell, Nov 25, 2010 IP
  2. elicitservers

    elicitservers Peon

    Messages:
    714
    Likes Received:
    7
    Best Answers:
    1
    Trophy Points:
    0
    #2
    Most ISP's block port 25 outgoing, I'm assuming this is what's happening. You shouldn't have the issue when you use an actual hosting service or dedicated server, where port 25 is not blocked (unless the host limits this).
     
    elicitservers, Nov 25, 2010 IP
  3. jeremyhowell

    jeremyhowell Member

    Messages:
    379
    Likes Received:
    7
    Best Answers:
    2
    Trophy Points:
    45
    #3
    Just tested it online, it works fine, I guess I'll just give localhost a miss when testing my forms for now on. Thanks.
     
    jeremyhowell, Nov 25, 2010 IP
  4. shallowink

    shallowink Well-Known Member

    Messages:
    1,218
    Likes Received:
    64
    Best Answers:
    2
    Trophy Points:
    150
    #4
    you don't have a mail server installed.
     
    shallowink, Nov 25, 2010 IP
    jeremyhowell likes this.
  5. jeremyhowell

    jeremyhowell Member

    Messages:
    379
    Likes Received:
    7
    Best Answers:
    2
    Trophy Points:
    45
    #5
    OK, I suppose I would have to download some piece of software to set one up I am guessing, or am I missing something extremely obvious?
     
    jeremyhowell, Nov 25, 2010 IP
  6. shallowink

    shallowink Well-Known Member

    Messages:
    1,218
    Likes Received:
    64
    Best Answers:
    2
    Trophy Points:
    150
    #6
    yes. download one. no. the error message you posted is saying "can't find the mail server" in its own way. Works from web, but not locally supports the assumption. Didn't say what OS your computer is running though I'm sure one can be found via google. But, really, is it worth the effort? If it works on your computer isn't a real issue. Now working on the web, that's enough story.

    I believe x-mail was a free SMTP mail server for windows and it works good enough but it was years ago I used it.
    Was x-mail, still around : http://www.xmailserver.org/
     
    Last edited: Nov 25, 2010
    shallowink, Nov 25, 2010 IP
  7. jeremyhowell

    jeremyhowell Member

    Messages:
    379
    Likes Received:
    7
    Best Answers:
    2
    Trophy Points:
    45
    #7
    Yes I agree, as long as its gonna work on my site in the end, theres really no need making it run on my computer. Thanks anyway everyone.
     
    jeremyhowell, Nov 25, 2010 IP