we have code send mails using phpmailer including phpmailerautoload.php file in our php files like..
require "phpmailerautoload.php"; and
$mail = new phpmailer; but syntax not acceptable in zend framework2 files, says "fatal error" "class not found". i've tried move phpmailer library folder of zf2 & include them use lib\phpmailer\phpmailerautoloadwhich zf2 standard way of including library files, doesn't work.
did work on kind, please me
lib folder not there in zend framework 2 i've added in vendor & used

use lib\folder\file;
which works, coming error..it is.,
<br /> <b>fatal error</b>: class 'lib\phpmailer\phpmailerautoload' not found in <b>/var/www/html/sample.php</b> on line <b>503</b> <br />
it's idea add or edit stuff in vendor/ - let composer manage folder. per comment i'd suggest install phpmailer using composer instead, add:
"phpmailer/phpmailer": "~5.2", to 'require' section of composer.json , run composer install. suggested installation method in phpmailer's readme.
the error added question relates php not finding autoload include file. if switch composer don't need file @ can remove require line.
it's instantiate class you'd need use:
$mail = new \phpmailer; (note backslash), zf2 classes declare namespace @ start. backslash tells php should grab phpmailer class global namespace.
Comments
Post a Comment