ISPConfig Debian Multiserver Setup: Web Server & Mail deamon

Discussion in 'Installation/Configuration' started by vaio1, Nov 19, 2015.

  1. vaio1

    vaio1 ISPConfig Developer ISPConfig Developer

    Hi guys,
    when I try to execute some php code that try to send an email by the mail server smtp configuration I get a weird error message: unknown error.
    Have I to install an MTA service in the webserver too?
    Thanks
     
  2. florian030

    florian030 ISPConfig Developer ISPConfig Developer

    apt-get install postfix ?
     
  3. vaio1

    vaio1 ISPConfig Developer ISPConfig Developer

    The question is: Does the webserver, in the MultiServer setup, must have an MTA (sendmail/postfix) installed?
    thanks
     
  4. florian030

    florian030 ISPConfig Developer ISPConfig Developer

    No, you donĀ“t need a mta on a web-server. you can also use a remote-server.
    personaly, i install postfix on a web-server to and setup a relay-server
     
  5. vaio1

    vaio1 ISPConfig Developer ISPConfig Developer

    I have noticed a weird behaviour of the system when I try to send an email using the mail server in my php script. I mean that I have wrote a simple script that uses the SMTP mail server to send the email but the script is located at the webserver hosting plan space. When I run the code I get a message: unknown error.
    I have tried to replicate the error on a local pc and I have discovered that the error appear when there is not any MTA installed.
    thanks
     
  6. till

    till Super Moderator Staff Member ISPConfig Developer

    There should be a minimal postfix setup on the mailserver, you can set it up as relay server to send emails trough your mail server.
     
  7. vaio1

    vaio1 ISPConfig Developer ISPConfig Developer

    How can I set up the relay server to send emails trough the mail server?
     
    Last edited: Nov 22, 2015
  8. ressel

    ressel Member

    On webserver:
    Insert following line, with your server instead in /etc/postfix/main.cf
    Code:
    relayhost = mail.example.com
    On mail server:
    And you might want to add your webserver in /etc/postfix/main.cf in the line mynetworks
     
  9. vaio1

    vaio1 ISPConfig Developer ISPConfig Developer

    There is any /etc/postfix/main.cf in my webserver configuration.
     
  10. till

    till Super Moderator Staff Member ISPConfig Developer

    Then you haven't installed postfix yet.
     
  11. vaio1

    vaio1 ISPConfig Developer ISPConfig Developer

    In fact it is the first question of this thread: Have I to install an MTA service in the webserver too?
     
  12. ressel

    ressel Member

    I would do it, because then your server will also be able to send alert mails if some errors occur.
    If you etc. would like to setup monit and munin.
     
  13. florian030

    florian030 ISPConfig Developer ISPConfig Developer

    see my 2nd answer. use a remote mta or setup a local mta and relay the mails.
     
  14. vaio1

    vaio1 ISPConfig Developer ISPConfig Developer

    Hi florian030,
    how have I to use a remote mta? Seems to me a good solution.
    Thanks
     
  15. ressel

    ressel Member

    in your php script.
     
  16. vaio1

    vaio1 ISPConfig Developer ISPConfig Developer

    @ressel yes of course. I have set the php script to connect using the smtp of the external server but the script creates the error wrote above
     
  17. ressel

    ressel Member

    What function are you using to send mails with?
     
  18. vaio1

    vaio1 ISPConfig Developer ISPConfig Developer

    I am using the GoalioMailService zend module.
    Code:
        <?php
        /**
         * GoalioMailService Configuration
         *
         * If you have a ./config/autoload/ directory set up for your project, you can
         * drop this config file in it and change the values as you wish.
         */
        $settings = array(
       
            /**
             * Transport Class
             *
             * Name of Zend Transport Class to use
             */
            'transport_class'   => 'Zend\Mail\Transport\Smtp',
            'options_class' => 'Zend\Mail\Transport\SmtpOptions',
            'options' => array(
                    'host'             => 'mail.externalserver.com',
                    'port'             => 25,
                    'connectionClass'  => 'login',
                    'connectionConfig' => array(
                    //                     'ssl'      => 'tls',
                            'username' => [email protected]',
                            'password' => 'mypassword',
                    ),
            ),
       
            /**
             * End of GoalioMailService configuration
             */
        );
       
        /**
         * You do not need to edit below this line
         */
        return array(
            'goaliomailservice' => $settings,
        );
    
     
  19. ressel

    ressel Member

    Try this:
    Code:
    $settings = array(
        'type' => 'Zend\Mail\Transport\Smtp',
    
        'options_class' => 'Zend\Mail\Transport\SmtpOptions',
    
        'options' => array(
            'host' => 'mail.externalserver.com',
            'connection_class' => 'login',
            'connection_config' => array(
                'ssl' => 'tls',
                'username' => [email protected]',
                'password' => 'YOUR-PASSWORD-HERE'
            ),
            'port' => 587
        )
    );
     
  20. vaio1

    vaio1 ISPConfig Developer ISPConfig Developer

    Nothing to do.
    It doesn't work at the remote ISPConfig server.

    [​IMG]

    In the local server with the MTA installed, it works as well.
     

Share This Page