Jump to content

Recommended Posts

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]

Link to comment
https://forums.phpfreaks.com/topic/187054-mail-not-working-where-to-trouble-shoot/
Share on other sites

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.

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.

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.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.