AndyB
Well-known member
I would like to create a PHP script to send an email using SMTP.
The PHP script below is not working. Do I have to do anthing special to use Zend commands?
When I execute this script, I get the following error message in my Centos server log:
The PHP script below is not working. Do I have to do anthing special to use Zend commands?
PHP:
<?php
$config = array(
'ssl' => 'tls',
'port' => 587,
'auth' => 'login',
'username' => 'example@gmail.com',
'password' => 'mypassword'
);
$smtpConnection = new Zend_Mail_Transport_Smtp('smtp.gmail.com', $config);
$mail = new Zend_Mail();
$mail->setBodyText('This is the text of the mail.');
$mail->setFrom('example@example.com', 'Some Sender');
$mail->addTo('example@example.com', 'Some Recipient');
$mail->setSubject('TestSubject');
$mail->send($smtpConnection);
?>
When I execute this script, I get the following error message in my Centos server log:
Code:
[Tue Feb 04 19:27:02 2014] [error] [client 25.5.96.60] PHP Warning: require_once(Zend/Mime.php) [<a href='function.require-once'>function.require-once</a>]: failed to open stream: No such file or directory in /path/to/www/forums/library/Zend/Mail/Transport/Smtp.php on line 27
[Tue Feb 04 19:27:02 2014] [error] [client 25.5.96.60] PHP Fatal error: require_once() [<a href='function.require'>function.require</a>]: Failed opening required 'Zend/Mime.php' (include_path='.:/usr/share/pear:/usr/share/php') in /path/to/www/forums/library/Zend/Mail/Transport/Smtp.php on line 27
Last edited: