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
The question is: Does the webserver, in the MultiServer setup, must have an MTA (sendmail/postfix) installed? thanks
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
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
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.
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
In fact it is the first question of this thread: Have I to install an MTA service in the webserver too?
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.
@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
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, );
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 ) );
Nothing to do. It doesn't work at the remote ISPConfig server. In the local server with the MTA installed, it works as well.