Coldbox Mail Service Error

I’m getting “The method getPlugin was not found in component D:\coldbox\system\mvc\Controller.cfc.” when I run below code to send email

coldbox.cfc

mailSettings = {
server = “XXXX”,
username = “XXX”,
password = “XXX”,
port = 587
};

Handlers/MailService.cfc
component
{
// get ColdBox to inject the MailService plugin for us
property name=“MailService” inject=“coldbox:plugin:MailService”;

void function send( required event )
{
//var rc = arguments.event.getCollection();

var Email = variables.MailService.newMail();
Email.setTo( “xxx@gmail.com” );
Email.setFrom( “Test EmailXXX@gmail.com” );

Email.setType( “html” );
Email.setSubject( “Test Email” );
Email.setBody( “

Test email MailService

” );
temp = variables.MailService.send( Email );
writeDump(temp);
abort;
// set thanks message
//rc.message = “Thank you for your comment”;

// set the view to show
//arguments.event.setView( “thanks” );

}
}

Do I need to add any other settings to resolve this. Thanks

Hi Rakesh,

If you are using coldbox-3.8.1 version then your syntax is correct, try to have another name for your handler “Mailer” instead MailService.

Plugin Docs
http://wiki.coldbox.org/wiki/Plugins:MailService.cfm

Also you can download coldbox-3.8.1 from

Are you using ColdBox Lite? It does not include plugins. You need to use the full ColdBox platform if you want the goodies.

I would also recommend you upgrade to ColdBox 4.0 as the mail services have been turned into an optional module.

Thanks!

~Brad

ColdBox Platform Evangelist
Ortus Solutions, Corp

E-mail: brad@coldbox.org
ColdBox Platform: http://www.coldbox.org
Blog: http://www.codersrevolution.com