- 
      
 - 
        
Save trung85/eb7a6a1970d9f16c9e3a49d96cd3a545 to your computer and use it in GitHub Desktop.  
    Mailcatcher installation script for Ubuntu 16.04 (14.04 commands commented out)
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | #!/bin/bash | |
| # Install dependencies | |
| # older ubuntus | |
| #apt-get install build-essential libsqlite3-dev ruby1.9.1-dev | |
| # xenial | |
| apt install build-essential libsqlite3-dev ruby-dev | |
| # Install the gem | |
| gem install mailcatcher --no-ri --no-rdoc | |
| # Make it start on boot | |
| echo "@reboot root $(which mailcatcher) --ip=0.0.0.0" >> /etc/crontab | |
| update-rc.d cron defaults | |
| # Make php use it to send mail | |
| # older ubuntus | |
| #echo "sendmail_path = /usr/bin/env $(which catchmail) -f 'www-data@localhost'" >> /etc/php5/mods-available/mailcatcher.ini | |
| # xenial | |
| echo "sendmail_path = /usr/bin/env $(which catchmail) -f 'www-data@localhost'" >> /etc/php/7.2/mods-available/mailcatcher.ini | |
| # Check config files | |
| # /etc/php/7.2/fpm/conf.d# ls -l | |
| # lrwxrwxrwx 1 root root 43 Th10 10 11:36 20-mailcatcher.ini -> /etc/php/7.2/mods-available/mailcatcher.ini | |
| # Notify php mod manager (5.5+, 7.2) | |
| # older ubuntus | |
| #php5enmod mailcatcher | |
| # xenial | |
| phpenmod mailcatcher | |
| # Start it now | |
| /usr/bin/env $(which mailcatcher) --ip=0.0.0.0 | |
| # Restart php7.2-fpm | |
| /etc/init.d/php7.2-fpm restart | |
test send mail:
if( mail('[email protected]', 'Feedback', 'This is so useful, thanks!') )
{
echo "Mail Sent!";
}
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment
  
            
cau hinh sendmail_path ben cli de run command php:
/etc/php/7.2/cli/php.ini
sendmail_path = /usr/bin/env /usr/local/bin/catchmail -f [email protected]
/etc/php/7.2/fpm/php.ini
cau hinh sendmail_path ben fpm de run ben web
sendmail_path = /usr/bin/env /usr/local/bin/catchmail -f [email protected]