Results 1 to 6 of 6

Thread: mailto problem?

  1. #1
    Join Date
    Jan 2007
    Location
    The stage
    Posts
    568
    Thanks
    23
    Thanked 6 Times in 6 Posts

    Default mailto problem?

    I have a problem on my computer with mailto function on php...
    It might be that I am testing on http://localhost/ and not on the online sever...
    I get this error when I load the page
    Code:
    Warning: 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:\netserver\www\corporate\contact2.php on line 67
    Line 67:
    PHP Code:
    mail($to,$subject,$txt,$headers); 
    Thanks

  2. #2
    Join Date
    Jan 2008
    Posts
    4,168
    Thanks
    28
    Thanked 628 Times in 624 Posts
    Blog Entries
    1

    Default

    What you wanna do is edit your php.ini. And find something like the image below.
    Jeremy | jfein.net

  3. #3
    Join Date
    Mar 2007
    Location
    Currently: New York/Philadelphia
    Posts
    2,735
    Thanks
    3
    Thanked 519 Times in 507 Posts

    Default

    Quote Originally Posted by Rockonmetal View Post
    It might be that I am testing on http://localhost/ and not on the online sever...
    That's exactly why. Unless you have a mail server also set up, you'll get that error.

    There are some workarounds, though I've never been able to implement any successfully. Which distribution do you run -- XAMPP? WAMP? MAMP?

  4. The Following User Says Thank You to Medyman For This Useful Post:

    Rockonmetal (05-06-2008)

  5. #4
    Join Date
    Jan 2007
    Location
    The stage
    Posts
    568
    Thanks
    23
    Thanked 6 Times in 6 Posts

    Default

    Quote Originally Posted by Medyman View Post
    That's exactly why. Unless you have a mail server also set up, you'll get that error.
    Ok so when I upload it to my site (pureadd.com) it will work... (right?)
    Quote Originally Posted by Medyman View Post
    There are some workarounds, though I've never been able to implement any successfully. Which distribution do you run -- XAMPP? WAMP? MAMP?
    I use Netserver. I could get WAMP to display localhost but never get phpmyadmin running... For some reason XAMPP and WAMP never worked out of the box. XAMPP totally confused itself continuously during installation. It was hilarious. I think the error was "Installation problem: Step 3 of 4 in installation process: Cannot find installation file" or something stupid like that... I was dumbfounded so I went back to Netsever.
    Thanks!
    FORGOT SOMETHING AND EDITTED: Oh Nile my php.ini is exactly like that it doesn't work but I don't need it to work though. I just need to know if if I had messed up badly... Thanks though!
    Last edited by Rockonmetal; 05-06-2008 at 11:45 PM.

  6. #5
    Join Date
    May 2007
    Location
    By the beach
    Posts
    23
    Thanks
    0
    Thanked 3 Times in 3 Posts

    Default

    The PHP mail() module sends email via a local MTA or SMTP. By default WAMP is not configured to send email. You would need to set the SMTP host in the php.ini file. The easiest work around is to use a live server to test or place an '@' sign in front on the mail() call to skip the timeout and error message.

    Example:
    //will still fail on localhost, but will allow PHP to parse the rest of the file
    $sent = @mail($to, $subject, $message, $headers);

    Alternative:

    1. Open your local php.ini file (left click wamp icon > php > php.ini)
    2. Find the following code:

    [mail function]
    ; For Win32 only.
    SMTP = localhost
    smtp_port = 25

    3. Change the SMTP variable to your local ISP SMTP outbound host.

    [mail function]
    ; For Win32 only.
    SMTP = mail.exampleisp.com
    smtp_port = 25

    4. Save php.ini file
    5. Restart WAMP (left click wamp icon > restart all services)

  7. #6
    Join Date
    Mar 2007
    Location
    Currently: New York/Philadelphia
    Posts
    2,735
    Thanks
    3
    Thanked 519 Times in 507 Posts

    Default

    Ok so when I upload it to my site (pureadd.com) it will work... (right?)
    Yup. It'll work on a host that has a mail server set up.

    What phpsales suggests above *might* also work. It depends on your ISP. A lot of ISPs have this blocked (my last 2 have at least).

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
  •