Take the 2-minute tour ×
Ask Different is a question and answer site for power users of Apple hardware and software. It's 100% free, no registration required.

I found this awesome tutorial on how to send emails on localhost that will open your Mail showing you the email that was sent from PHP, however this is slightly annoying getting Mail to open when an email is sent - I have some tasks that run in the background which sends an email for development reasons for my site so I can test the emails.

I want to be able to not get annoyed by getting popped up with emails, instead I would like it to pipe it to Mail and show in my inbox when I click "Get new messages" so I can look into the email whenever I want not at the instant when the email is sent.

I've looked into where Mail stores their email ~/Library/Mail/V2, I was wondering if I could adjust the script to add the email there, but it looks quite complication so I don't want to risk having any confusion or corruption happening.

Is there any possibility to store the mails without any problems so Mail can add it to my inbox list via PHP?

Anything?

share|improve this question
    
Why do you not set up a seperate email account for your testing that does not check for messages automatically? Tampering with the mailbox files is not recommended and likely to break. –  Gerry Aug 16 '12 at 14:31
    
I don't understand? In the PHP script, it runs a command of opening the email with Mail, not Mail fetching the email. Please read carefully. –  Burning the Codeigniter Aug 16 '12 at 14:51
    
All the script does it writing a .elmx file which is then opened by Mail. This already is (honestly) quite a hack and you will run into even more trouble if you start to mess around with ~/Library/Mail. The better road to take is definitively to enable the local sendmail and just send a mail locally. –  patrix Sep 4 '12 at 14:14
add comment

1 Answer 1

up vote 2 down vote accepted
+50

You can do what you ask, but it requires a Mailbox > Rebuild operation. That asks Mail to scan the ~/Library/Mail directory you found and rebuild its email header database from the files it finds there. I doubt you'd find that acceptable.

I'm afraid Gerry's comment above is the right way to go about this: set up a test email account somewhere, use one of the many PHP-to-SMTP methods you can find online, and point Apple Mail at that email account.

Perhaps the simplest, most Apple-like way to achieve that end is with OS X Server. It gives you a configuration UI for the Postfix SMTP mail server built into OS X. Setup through the Server GUI is about as easy as you can hope for. You can create a private user account, and be assured that your test emails won't ever even leave the machine. As cheap as OS X Server is these days, it's pretty much a no-brainer.

If you absolutely have to do this for no cost, you can configure Postfix by hand. The configuration GUI you get with OS X Server is helpful, but not strictly necessary.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.