1

I've a dedicated server for sending emails with different domain and I'm running nginx and php on the ubuntu server. I've configured ssmtp to send emails which is working fine from terminal using echo from terminal. I want to use php mail function to send mails from the server and I'm using ssmtp. How can I do that? I've made changes in php.ini file in php fpm directory as follows:

smtp_port = 25
sendmail_from = noreply@instaclasses.info
sendmail_path = /usr/sbin/ssmtp
mail.add_x_header = On

I need to configure the php mail function so that any mail sent from mail function is sent from default smtp server configured already.

vishgarg
  • 333
  • 1
  • 6
  • 21
  • Have a look at [this SO question](http://stackoverflow.com/questions/14456673/sending-email-with-php-from-an-smtp-server) that deals with using mail() with remote SMTP server on linux. – SaschaM78 Jan 14 '17 at 16:33

1 Answers1

1

You can use PHPMailer - this very usefull library. In this all working from all external servers (inc. GMail).

JDStar
  • 33
  • 1
  • 5
  • 1
    Yes I can use that too but I want if any developer uses mail function then my default mail server should be used :) – vishgarg Jan 14 '17 at 16:10