I have a demo database and form (using MAR) on a remote server and
upon submission I get a notification email as expected. I have the
same demo setup locally; is there a way to replicate the notification
functionality (for testing purposes) even though MAR can’t access the
remote mail server? This isn’t a problem really, I’m just curious.
You can enable the mailserver built in to your Mac. Actually, it’s on by default, IIRC. Just try the following in a new plain PHP file:
mail('your-email','Hello from PHP',"This is a testnn",'From:your-email','-fyour-email');
Replace your-email above with your actual email address (just the todd(a)wherever.com part) That last argument to the function is not a typo – it really is a hyphen, the letter f, and your e-mail address all smashed together.
If that test doesn’t work, Google for Postfix Enabler. Very quick and easy to use, and it will definitely allow you to send mail from any Mac.
Right now the model file contains the emailing code so do I need to
remove that from the local copy? And does the new file need to be
called from another file or simply placed within the mar app?
On Feb 19, 2009, at 10:06 AM, waltd wrote:
You can enable the mailserver built in to your Mac. Actually, it’s
on by default, IIRC. Just try the following in a new plain PHP file:
mail('your-email','Hello from PHP',"This is a testnn",'From:your-
email','-fyour-email');
Oh, and the code in the model file probably uses the exact same syntax as this test file – this is just the normal way to send mail from PHP. The PHP application server assumes that sendmail will be properly configured (or if you’re on Windows, that the proper SMTP host has been configured in the php.ini file). As long as you are running PHP on your Mac (and I presume MAMP is the same deal) you will just need to have sendmail or postfix set up to send mail, which they normally are and do, out of the box.
If this doesn’t work on the desktop, then try again in the MAMP site folder. Drop the file in there, and navigate to it using whatever address MAMP dictates for you: localhost:8002 or something like that – and tack mail.php on to that URL. See if you get a message when you visit that page locally. You should.
Well, I tried it on the Desktop with the Terminal. No message. Tried
it in the MAMP site folder. No message. Tried inside the MAR folder
(inside MAMP), no message. PostFix Enabler doesn’t work on Leopard but
MailServe does (same dev) but is $15 though I’m not ready to buy it
just for this one purpose. Is there a way to verify the local mail
server is active using the Terminal?
Thanks,
Todd
On Feb 19, 2009, at 11:27 AM, waltd wrote:
If this doesn’t work on the desktop, then try again in the MAMP site
folder. Drop the file in there, and navigate to it using whatever
address MAMP dictates for you: localhost:8002 or something like that
– and tack mail.php on to that URL. See if you get a message when
you visit that page locally. You should.
you will just need to have sendmail or postfix set up to send mail
Hmm. (Daydream mode: on) What are the chances that this could be used
to send mail from my Mac, within my university network, without
having to use the brain-dead university mail server?
Very strong chances, as long as your ISP or the University haven’t
blocked the relevant ports in their firewall.
I strongly recommend using an application like Postfix Enabler to
toggle this setting, it’s do-able with the command line, but only
just. Well worth the $19 shareware or so.
Walter
On Feb 25, 2009, at 1:35 PM, Keith Martin wrote:
you will just need to have sendmail or postfix set up to send mail
Hmm. (Daydream mode: on) What are the chances that this could be
used to send mail from my Mac, within my university network, without
having to use the brain-dead university mail server?