You are viewing an old version of this page. View the current version.
Compare with Current
View Page History
Version 1
Next »
Problem
Following a fresh install of Zend Server 2018 (PHP7.2.1) php mail stopped working.
The following message is given in the Apache HTTPD log file www\zendphp7\logs\error_log.Q_date_time_stamp:
sh: /usr/sbin/sendmail: not found
Possible cause when the Zend Server libraries deployed are not updated to the latest versions available.
IBM i not connected to the web,(no internet access).
Solution
Download and deploy the latest Zend Framework Libraries.
Use the SMTP Transport found in Zend Framework a more reliable and easy to implement.
In the following article you can find an examples written for Zend Framework 1 and Zend Framework 2.
https://zend18.zendesk.com/hc/en-us/articles/222086648
ZF1 example script:
<?php
$tr = new Zend_Mail_Transport_Smtp('mail.example.com');
Zend_Mail::setDefaultTransport($tr);
$mail = new Zend_Mail();
$mail->setBodyText('This is the text of the mail.');
$mail->setFrom('[email protected]', 'Some Sender');
$mail->addTo('[email protected]', 'Some Recipient');
$mail->setSubject('TestSubject');
$mail->send();
ZF2 example script:
<?php
ini_set('include_path', '/usr/local/zendphp7/share/ZendFramework2/library');
require_once 'Zend/Loader/StandardAutoloader.php';
$loader = new Zend\Loader\StandardAutoloader(array('autoregister_zf' => true));
$loader->register();
use Zend\Mail\Message;
use Zend\Mail\Transport\Smtp as SmtpTransport;
use Zend\Mail\Transport\SmtpOptions;
$message = new Message();
$message->addTo('[email protected]')
->addFrom('[email protected]')
->setSubject('TestSubject')
->setBody("This is the text of the mail.");
// Setup SMTP transport
$transport = new SmtpTransport();
$options = new SmtpOptions(array(
'name' => 'example.com',
'host' => 'mail.example.com',
'port' => 25,
));
$transport->setOptions($options);
$transport->send($message);
?>
Related articles
https://framework.zend.com/manual/2.4/en/modules/zend.mail.smtp.options.html
https://zend18.zendesk.com/hc/en-us/articles/222086648-Use-Framework-s-SMTP-Transport-instead-of-mail-on-IBM-i
https://zend18.zendesk.com/hc/en-us/articles/203405413-IBMi-SMTP-Mail-The-PHP-mail-Function-
http://files.zend.com/help/Zend-Server/content/libraries.htm
http://www.zend.com/en/company/community/framework/downloads#Windows
https://framework.zend.com/blog/2017-03-21-create-zpks-the-easy-way.html
-
Page:
-
Page:
-
Page:
-
Page:
-
Page: