php mail on MAMP

后端 未结 6 1938
栀梦
栀梦 2020-12-10 11:23

I need to test some script using PHP\'s mail. I\'d like to be able to finally get this working locally. I am using MAMP. Is there a way to do this without installing any thi

6条回答
  •  萌比男神i
    2020-12-10 12:26

    I think the best solution is write all messages to file. So you just need to make own sendmail.

    1. add to httpd.conf file this strings:

      php_admin_value sendmail_path
      "/Applications/MAMP/somefolder/mysendmail.sh"

    2. In the file mysendmail.sh add following:

      #!/bin/bash

      while read line do echo "$line" >> ../mail_log.txt done

      echo "------------- next mail ----------------" >> ../mail_log.txt

      exit 0

    3. Do not forget to set privilegies: chmod 755 mysendmail.sh

提交回复
热议问题