我在应用程序的根目录中有Zend:
myapp/Zend
如何将其包含在我的应用程序中?我已经尝试过include_once,require_once和set_include_path,但似乎没有任何效果。我一直收到以下错误:
Fatal error: Class 'Zend\Mail\Message' not found in
我创建了一个名为'mail-test.php'的文件,这里是代码:
use Zend\Mail\Message;
use Zend\Mail\Transport\Smtp as SmtpTransport;
use Zend\Mail\Transport\SmtpOptions;
$message = new Message();
$message->addTo('myfriend@example.com')
->addFrom('email@example.com')
->setSubject('Contact Form');
$message->setBody('This is my message, read it.');
$transport = new SmtpTransport();
$options = new SmtpOptions(array(
'name' => 'my.secure.server',
'host' => '555.555.5.55',
'port' => 465, // Notice port change for TLS is 587
'connection_class' => 'plain',
'connection_config' => array(
'username' => 'username',
'password' => 'password',
'ssl' => 'tls',
),
));
$transport->setOptions($options);
$transport->send($message);