Include 3rd party library pear mail

hmm this may sound simple but how do i include 3rd party libs??

for example i wanna include pear mail, where should i place it?? in extension dir or models dir??

It depends,

I would place it in a protected/vendors and then import it… with [font="Menlo, Consolas,"][size="2"][color="#008000"]Yii::import()[/color][/size][/font]

Then you configure it in protected/config to include the directory…


	// autoloading model and component classes






Then you drop your 3rd party library inside it.

or you could follow the recommended directory structure http://www.yiiframew…ect-site/#c3192

Hope that helps ;)


tks. i actually place into the extensions dir and tried calling manually like this:






it works for a while but now its giving an error:

include(Mail_smtp.php) [<a href='function.include'>function.include</a>]: failed to open stream: No such file or directory

any idea why now its autoloading??

my function is as follows:

public function sendEmail($toEmail='', $subj='', $body='', 

							  $smtpUsrName='', $smtpPasswd='', $frmHdr='') {








		$body = nl2br($body);


	    $headers = array(

	    'From' => $frmHdr,

	    'To' => $toEmail,

	    'Subject' => $subj);


	    $smtp = Mail::factory('smtp',

	     array ('host' => $this->smtpHost,

	       'auth' => true,

	       'username' => $smtpUsrName,

	       'password' => $smtpPasswd));


	    //Mime settings

	    $crlf = "\n";

	    $mime = new Mail_mime($crlf);



	    //do not ever try to call these lines in reverse order

	    $htmlbody = $mime->get();

	    $headers = $mime->headers($headers);


	    $mail = $smtp->send($toEmail, $headers, $htmlbody);


	    if (PEAR::isError($mail)) {

	      	return false;


	    else {

	     	return true;



sorry my bad. it was some directory issue. weird cos my file got removed after i rename the directory. am using eclipse =)

Glad to know its working out