mmccracken Posted January 3, 2010 Share Posted January 3, 2010 MAMP version 1.4.1 Mac 10.5.6 (work machine) attached is the original file that didn't work. (phpInfo() display's correctly, so the Apache is running php.) Beginner level, stuck on mail(), and I don't have the breadth of experience to know where to continue after: I started out with a flash/php textbook example (attached file), that didn't work, then I tried to simplify the script, making it a standalone file (no flash) without success, then I simply went online and used w3's minimum email script: <?php $txt = "First line of text\nSecond line of text"; // Use wordwrap() if lines are longer than 70 characters $txt = wordwrap($txt,70); // Send email mail("[email protected]","My subject",$txt); ?> Where I substituted [email protected] with my private, work and then even my girlfriends email. no email comes through! I then tried old php script that I wrote 2 months ago, that I know works - doesn't work now. I haven't touched the apache settings, so I can't figure out why it's not working. (tested that my email is working by sending myself emails that comes through) I installed MAMP on another laptop, tried the w3's script again, no email comes through. I am at a complete loss here.. Where would I start troubleshooting? [attachment deleted by admin] Quote Link to comment https://forums.phpfreaks.com/topic/187054-mail-not-working-where-to-trouble-shoot/ Share on other sites More sharing options...
teamatomic Posted January 4, 2010 Share Posted January 4, 2010 Dont know about macs but in your php.ini file you have a SMTP=. Have you set it to your ISP's SMTP server? HTH Teamatomic Quote Link to comment https://forums.phpfreaks.com/topic/187054-mail-not-working-where-to-trouble-shoot/#findComment-987887 Share on other sites More sharing options...
mmccracken Posted January 4, 2010 Author Share Posted January 4, 2010 Thank you for your response. I only found 2 statements with SMTP in the php.ini file: [mail function] ; For Win32 only. SMTP = localhost smtp_port = 25 I presume it does not even apply to a mac (Don't know why it's in the MAMP at all, but guess something else is dependent on that information. However being that Mac is Unix under the hood, I found this statement further down. Shouldn't this be uncommented and filled out after the equal sign? ; For Unix only. You may supply arguments as well (default: "sendmail -t -i"). ;sendmail_path = thanks for any help. Quote Link to comment https://forums.phpfreaks.com/topic/187054-mail-not-working-where-to-trouble-shoot/#findComment-988147 Share on other sites More sharing options...
PFMaBiSmAd Posted January 4, 2010 Share Posted January 4, 2010 For debugging purposes, add the following two lines of code immediately after the first opening <?php tag to show all php errors (i.e to see if there are any errors produced by the mail() function) - ini_set("display_errors", "1"); error_reporting(E_ALL); The comments in the php.ini are incorrect. The SMTP and smtp_port settings are used whenever you are using the mail() function and are interfacing with the sending mail server using the SMTP protocol. The sendmail_path setting is used anytime you are interfacing with the sending mail server (even on Windows) using the command-line/API of the sending mail server. Quote Link to comment https://forums.phpfreaks.com/topic/187054-mail-not-working-where-to-trouble-shoot/#findComment-988155 Share on other sites More sharing options...
mmccracken Posted January 4, 2010 Author Share Posted January 4, 2010 Suddenly all my test emails from 2 days up until this morning came through my inbox. ??? the only that that changed, I'm in the office. That makes no sense as I am using MAMP locally. Will try when I get home. thanks for everybody's help. Quote Link to comment https://forums.phpfreaks.com/topic/187054-mail-not-working-where-to-trouble-shoot/#findComment-988172 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.