Setting basic smtp server for one website

Discussion in 'Installation/Configuration' started by ian_ms, Apr 4, 2018.

  1. ian_ms

    ian_ms New Member

    Hi,
    I would like to set up a custom smtp server for the php mail() function only for one website. I've tried to add those lines into "Custom php.ini directives";
    Code:
    SMTP="mail.smtp2go.com"
    smtp_port="2525"
    When I run phpinfo(), I see that the values have changed. I then ran the script to send the email and I received it. BUT, when I check the headers of the email, its still sent by local postfix and not from the custom SMTP specified in php.ini. Am I doing something wrong?
    Thank you very much for your help
     
  2. till

    till Super Moderator Staff Member ISPConfig Developer

    It might be that these settings are recognized by PHP on Windows only. Is the app that you use in that site not able to use SMTP to send email instead of the mail() function?
     
  3. ian_ms

    ian_ms New Member

    Im using a plugin for all our CMS/WordPress websites that allow me to send trough SMTP like you mentionned, so I never had the problem before. In this case, its a custom made website that use the really basic php mail() function and I have to find a way to send these emails using their smtp2go account. Is there something that I can do?
     
  4. till

    till Super Moderator Staff Member ISPConfig Developer

    Something like this might work:

    https://github.com/smalot/sendmail-smtp

    you don't edit the php.ini in this case, use the php.ini field of the website to set the path to the sendmail wrapper script.
     
    ian_ms likes this.
  5. ian_ms

    ian_ms New Member

    Thanks for your replies till, it helps a lot.
    Do you think that will cause problems with future updates? If I understand, I can install this "sendmail copy" with smtp support and only use it for this website by configuring the sendmail_path into the custom php.ini directives. I do not want to replace the "real" sendmail in the default php.ini so that other websites are not affected right?
     
  6. till

    till Super Moderator Staff Member ISPConfig Developer

    I don't expect any problems as you will not replace the default sendmail systemwide.
     
  7. ian_ms

    ian_ms New Member

    Hi till,

    I tested it right away. But it seems that the sendmail_path value does not want to change.
    I entered into custom php.ini settings, is that what you meant by php.ini field of the website?
    Code:
    sendmail_path = "/etc/sendmail-smtp/sendmail.phar -f /etc/sendmail-smtp/smtp2go.yml"
    I checked with phpinfo() and it returns the default value which is
    Code:
    /usr/sbin/sendmail -t -i -f [email protected]
    Do you know why it does not change?
     
    Last edited: Apr 4, 2018
  8. till

    till Super Moderator Staff Member ISPConfig Developer

    Which PHP mode do you use in that website?
     
  9. ian_ms

    ian_ms New Member

    I am on Fast-CGI PHP 5.6, it is default setting in my case. I tried with PHP-FPM too, but no luck. If necessary, I can switch to another mode. I took my time to search in the forums and it seems to be an hard one to change. The only thing I found is parameters in a file named .php-fcgi-starter. Maybe you have the trick to do it.
     
    Last edited: Apr 5, 2018

Share This Page