Tuesday, September 15, 2009

How to: Sending Emails with MAMP PRO

Sometimes you may need to send an email with PHP. To do so you have to configure and start Postfix. Ok, you could read the Postfix documentation, but it´s a bag of hurt. An easier way getting Postfix run is using the configuration tool built into MAMP PRO.
If you want to use the PHP function mail() for sending emails to your own email address (like mail@johndoe.com) you just need to open MAMP PRO, go to Server -> Postfix and add the value "johndoe.com" (without quotes and the according domain name) into the field "Domain of outgoing mail".

If you want to send emails to any other addresses, activate the checkbox "Smart Host" and fill in the according fields:

Host: Fill in your server name for outgoing emails. This could be for instance "smtp.johndoe.com" (without quotes). Ask your provider if you are unsure about the server name.

User: Add the user name of your mail account.

Password: Add the password for your email user account.

Authentication: Leave to "None"

Click the button "Change Postfix configuration". Everything should work now. If it doesn't: Some providers do not allow Smart-Hosts, like Google and Gmail. So you should probably check this first.

Share/Save/Bookmark

23 Kommentare:

  1. I've just purchased MAMP Pro with the sole purpose of enabling sending mail from my local development machine.

    I have tried both methods available (just setting the outgoing domain and configuring a Smart Host), but neither work.

    I have a Gmail account, and as you suggest Google won't allow my email to be sent. When I look in my error logs I see an "Operation timed out" message.

    So what now? For your customers that only have Gmail accounts, what do you suggest they do?

    This is quite frustrating. It seems misleading to suggest MAMP Pro can enable sending of emails when it doesn't.

    ReplyDelete
  2. Yes, neither method works here. I have my own domain but am unable to get this function working. I want to send email from my localhost to gabor@gabor.hu

    1. My domain is gabor.hu, I'll enter this to the "Domain of outgoing mail" textbox. Nothing happens.

    2. I try to enter the following settings to the "Smart Host" section:
    - host: mail.gabor.hu
    - username: gabor@gabor.hu
    - password: password
    - authentication: both method is tried

    Nothing and nothing happens. The php sends the letter properly, the boolean value is true, but the emails never arrive.

    Too bad.

    ReplyDelete
  3. Why no reaction from the MAMP staff?

    ReplyDelete
    Replies
    1. I purchased mamp pro before. I didn't get any help when I couldn't use the features either. The best thing is to just use the free version, and modify the apache configuration file by researching the web.

      Delete
  4. Hello MAMP Pro,

    I purchased the software with a credit card and if no solution is provided to this email sending matter using php script with MySql provided in your software, I may be forced to dispute the credit card charges from your company for misrepresenting your product to your customers.

    ReplyDelete
  5. "Host: Fill in your server name for outgoing emails.
    User: Add the user name of your mail account.
    Password: Add the password for your email user account.
    Authentication: Leave to "None"...

    I can't fill in User and Password when Authentication is "None"...

    Have tried the other two, nothing works...

    ReplyDelete
  6. This worked for me, and saved my bacon today:

    Domain of outgoing mail: frontendcoder.com

    √ Smart Host
    Host: mail.frontendcoder.com
    User name: admin@frontendcoder.com
    Password: ****sekret****
    Authentication: Plain Text

    Good luck! MAMP PRO is a great product!

    ReplyDelete
  7. after several hours of trial and error, this seems to be working for german t-online... for now ;)


    Domain of outgoing mail: t-online.de

    √ Smart Host
    Host: smtprelay.t-online.de

    user/pass left blank
    no auth

    cheers...

    ReplyDelete
  8. I have tried every variation mentioned in this forum, and nothing works. I purchased MAMP pro purely to test emails. What a ripoff.

    ReplyDelete
  9. I purchased MAMP Pro yesterday because I need to test some email functionality for the site I'm working on. I've sat at my desk for hours trying to figure out why this isn't working. I've registered a whole host of free email addresses in the hope that one of them would work. So far I've had no luck for the following:

    - Gmail (this is my primary email)
    - Hotmail
    - Zoho
    - AIM
    - Gawab
    - Fastmail

    I'm confident that I've entered the right settings on the Postfix screen for each one, but none of them have worked. Is there anything anyone can suggest? A free email client or a method which will solve this issue?

    ReplyDelete
  10. I found the ultimate fox for this set the host with the brackets [mail.domain.com]
    Mail works fine now.
    So not impressed that MAMP Support did not respond.
    Great product, crap company!!!!!

    ReplyDelete
  11. Who is your email provider Bobby?

    ReplyDelete
  12. when i try to click apply, it is disabled and grayed out! why is this happening?

    ReplyDelete
  13. Domain of Outgoing mail should be your domain eg jadecomputing.co.uk

    smart host should be ticked

    host should be your outgoing email host eg auth.smtp.1and1.co.uk
    user name is you outgoing email user name eg David@jadecomputing.co.uk

    password should be your outgoing email password

    authentication should be plain text (select this first or you will not be able to fill in the above)

    Dave

    ReplyDelete
  14. Thanks man! Why can't software developer sites ever spell things out simply like this?

    ReplyDelete
  15. I had this working for about 10 minutes today, then it broke again. It would be great to have a "Send test message" button on the Postfix configuration page in MAMP Pro. Short of that, what's the easiest way to send a test message to see if it's working or not?

    ReplyDelete
  16. I've tried it with just about every fix that you guys have posted on here... none of them have worked so far. I have MAMP Pro

    ReplyDelete
  17. Alright, now I've been able to set the postfix up with a hosted email account. my host is DreamHost. I've sent a few test emails through a local contact form. Still not coming through. I know the credentials are correct. error log says:
    postfix/smtp[3737]: connect to ***.dreamhost.com[***.**.***.***]:25: Operation timed out

    Why is it still not working? is it the host?

    ReplyDelete
  18. And here we are, three years later, without a single answer to this from the MAMP folks. So what was that about the big bag of hurt? Which hurts more? Paying $$$ for a pro product to make things easier, only to find out that it doesn't work even for the one email provider you have complete settings for (me.com), or learning how to configure Postfix and saving some money?

    Setting up Postfix was a pain, but not terrible, and it's a lot less hurt than asking questions of people who have no intention of answering them and wasting money on "pro" software with amateur response.

    ReplyDelete
  19. Oh and for anyone finding this like I did, here's the simple answer to the problem:

    http://www.anujgakhar.com/2011/12/09/using-macosx-lion-command-line-mail-with-gmail-as-smtp/

    For $59, I'll come and type those commands on your Mac, and I'll even answer your email. ;-)

    ReplyDelete
  20. wow.. this is the shittiest company ever...

    ReplyDelete
  21. For those who hv an iCloud and Mac, this worked for me perfectly.

    http://transparatech.com/blog/how-enable-mamp-pro-2s-postfix-sending-email-your-lion-icloud-account

    ReplyDelete