HOI. recess developers,
Is there anyone who knows a guide for integration of vendor code (libraries) such as Zend or Swift mailer with Recess.
The book of recess chapter 14 does not tell yet.
http://www.recessfra.../html/ch14.html
I would like to know the most convenient way to do this.
Should I put Zend and Swift mailer into the plugins directory?
Let me know if you know.
Thanks a lot already.
I'm looking forward to your reply.
Cheers, Stinie
Page 1 of 1
Plugins & Extensibility How to integrate vendor code with Recess?
#3
Posted 08 December 2009 - 02:35 PM
Here it is. PHPMailer plugged for Recess. To use it simply extract it and put the contents into the plug-ins folder (meaning, the folder thebeline), and include it in the application class. Here is an example:
And use it just like you normally would.
<?php
Library::import('recess.framework.Application');
Library::import('thebeline.PHPMailer.PHPMailerPlugin'); // Here
class ExampleApplication extends Application {
public function __construct() {
$this->name = 'Example Application';
$this->viewsDir = $_ENV['dir.apps'] . 'exampleapp/views/';
$this->assetUrl = $_ENV['url.assetbase'] . 'apps/exampleapp/public/';
$this->modelsPrefix = 'exampleapp.models.';
$this->controllersPrefix = 'exampleapp.controllers.';
$this->routingPrefix = 'exampleapp/';
$this->plugins = array(new PHPMailerPlugin()); // And here
}
}
?>
And use it just like you normally would.
Attached File(s)
-
PHPMailer.zip (30.53K)
Number of downloads: 28
#5
Posted 20 December 2009 - 09:31 AM
beline, on 08 December 2009 - 08:35 PM, said:
Here it is. PHPMailer plugged for Recess. To use it simply extract it and put the contents into the plug-ins folder (meaning, the folder thebeline), and include it in the application class. Here is an example:
And use it just like you normally would.
<?php
Library::import('recess.framework.Application');
Library::import('thebeline.PHPMailer.PHPMailerPlugin'); // Here
class ExampleApplication extends Application {
public function __construct() {
$this->name = 'Example Application';
$this->viewsDir = $_ENV['dir.apps'] . 'exampleapp/views/';
$this->assetUrl = $_ENV['url.assetbase'] . 'apps/exampleapp/public/';
$this->modelsPrefix = 'exampleapp.models.';
$this->controllersPrefix = 'exampleapp.controllers.';
$this->routingPrefix = 'exampleapp/';
$this->plugins = array(new PHPMailerPlugin()); // And here
}
}
?>
And use it just like you normally would.
HOI. beline,
Thanks al lot for sharing!
I'll use your plugin in the meantime.
I'll try to learn from it.
Cheers, Stinie
#7
Posted 27 March 2010 - 04:47 AM
beline, on 08 December 2009 - 08:35 PM, said:
Here it is. PHPMailer plugged for Recess. To use it simply extract it and put the contents into the plug-ins folder (meaning, the folder thebeline), and include it in the application class. Here is an example:
And use it just like you normally would.
<?php
Library::import('recess.framework.Application');
Library::import('thebeline.PHPMailer.PHPMailerPlugin'); // Here
class ExampleApplication extends Application {
public function __construct() {
$this->name = 'Example Application';
$this->viewsDir = $_ENV['dir.apps'] . 'exampleapp/views/';
$this->assetUrl = $_ENV['url.assetbase'] . 'apps/exampleapp/public/';
$this->modelsPrefix = 'exampleapp.models.';
$this->controllersPrefix = 'exampleapp.controllers.';
$this->routingPrefix = 'exampleapp/';
$this->plugins = array(new PHPMailerPlugin()); // And here
}
}
?>
And use it just like you normally would.
Hi,
Thanks for sharing.
But am missing an important point. How to use a plugin in Recess? I have the plugin up in the directory, and also added the needed stuf to the application class.
But have no clue how to import it into the controller class. If I just try:
/** !Route GET, send */
function send(){
//send test email
$mailer = new PHPMailer();
// Set the subject
$mailer->Subject = 'This is a test';
// Body
$mailer->Body = 'This is a test of my mail system!';
// Add an address to send to.
$mailer->AddAddress('my@email.com', 'Name Name');
if(!$mailer->Send())
{
echo 'There was a problem sending this mail!';
}
else
{
echo 'Mail sent!';
}
}
I get a Recess error:
PHPMailer has not been imported.
139:
140: /** !Route GET, send */
141: function send(){
142: //send test email
143: $mailer = new PHPMailer();
144: // Set the subject
145: $mailer->Subject = 'This is a test';
146:
147: // Body
148: $mailer->Body = 'This is a test of my mail system!';
May I ask you to help?
Thanks,
Regards,
Tamas
Page 1 of 1

Sign In
Register
Help


MultiQuote