-1

I'm using MAMP PRO 4.2 (9213) on MacOS Sierra with PHP 7.1.8.

In the postfix section I filled my_domain.com in domain name for outgoing messages and I checked take postfix in GroupStart.

Calling that short snippet (that works on another server) I'm getting no e-mail (test@example.com is placeholder for my real own e-mail):

<?php
$to = "test@example.com";
$subject = "Test";
$mail = "Hello, this is a test!";
mail($to,$subject,$mail);
?>

What am I doing wrong? How can I make PHP mail() work?

  • 1
    The mail function is disabled in MAMP Pro. You will need to look in to using SMTP. Google using a gmail account as a SMTP mail relay. – WizardCoder Sep 18 '17 at 21:35
  • Not code-related. Mail-server configuration is entirely off-topic. – mario Sep 19 '17 at 01:44
  • I found the solution: I, of course, have to use smarthost. After checking the smarthost checkbox and filling mail server domain, username and password it worked. –  Sep 19 '17 at 08:13

1 Answers1

-1

MAMP Pro disables the mail function.

The mail function is pretty terrible for a whole host of reasons, not least of which is that the emails it sends are often regarded as spam by commercial email service providers.

You should consider using an email service like mailjet (which offers 6,000 free emails a month) or sendGrid to send your emails.

Ben Shoval
  • 1,732
  • 1
  • 15
  • 20
  • 1
    I found the solution: I, of course, have to use smarthost. After checking the smarthost checkbox and filling mail server domain, username and password it worked. –  Sep 19 '17 at 08:13