View Full Version : mailto problem?
Rockonmetal
05-05-2008, 11:48 PM
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
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:
mail($to,$subject,$txt,$headers);
Thanks
What you wanna do is edit your php.ini. And find something like the image below.
Medyman
05-06-2008, 12:02 AM
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?
Rockonmetal
05-06-2008, 08:15 PM
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?)
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!
phpsales
05-08-2008, 10:14 PM
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)
Medyman
05-08-2008, 10:33 PM
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).
Powered by vBulletin® Version 4.2.2 Copyright © 2021 vBulletin Solutions, Inc. All rights reserved.