sending an email using MAMP and php scripts

14,965

MAMP is just Apache, MySQL and PHP and doesn't include a mail server. You could use postfix or, as you said, an external SMTP server.

If using Gmail make sure your account is setup to allow SMTP connections (it's off by default). This can be found somewhere in Settings in the web client. I'd recommend you test it with Mail or another mail client on your local machine to make sure Gmail is working as expected.

Finally (once the above is set up) SwiftMailer or PHPMailer are good mail libraries which can connect to remote SMTP servers. It'll save you a lot of headaches writing your own code, especially when it comes to file attachments and such.

Share:
14,965
Dev
Author by

Dev

Developer

Updated on June 27, 2022

Comments

  • Dev
    Dev about 2 years

    Hi I am running MAMP on my mac to locally host a website. I want to send an email using php scripts. The stuff i looked online tells me about php scripts for emails but i am unable to send emails. I am guessing this has to do with MAMP settings or maybe i have to make changes to php.ini file but i cant find information regarding that. Can i send emails to my clients using my gmail address running php scripts. I am creating a signup page where once you signup successfully, the site sents you a welcome email. Can some body please guide me how to do this. I have used code from here: http://email.about.com/od/emailprogrammingtips/qt/PHP_Email_SMTP_Authentication.htm but this doesnt work. i have used following settings: $host = "ssl://smtp.gmail.com"; $port = "465";

  • Dev
    Dev almost 13 years
    Hi thanks for your help. This explains a lot. However, im not sure which one is easier to use and whats the difference between postfix and PHPMailer. Ideally I want to avoid reading libraries.
  • jibiel
    jibiel over 11 years
    +1 for postfix as it comes preinstalled on OS X and require almost no configuration.