Hello all, I've been working with ColdFusion for a while now but am new to ColdBox and MVC in general. I've set up a test site and am having problems figuring out how to send emails using the cbmailservices plugin. I have what I hope are some basic newbie questions. I keep getting an error:
No matching function [GETINSTANCE] found
Here is my model, emailService.cfc. I am using the sample code from
https://www.forgebox.io/view/cbmailservices.
component accessors="true"{
// Properties
property name='mailService' inject='mailservice@cbmailservices';
property name='renderer' inject='provider:coldbox;renderer';
/**
* Constructor
*/
emailService function init(){
return this;
}
function contactUs(event,rc,prc) {
// build mail and send
var oMail = getInstance( "mailService@cbmailservices" )
.newMail( to="mys...@myemail.com",
from="mys...@myemail.com
",
subject="Mail Services Rock",
bodyTokens={ user="Luis", product="ColdBox", link=event.buildLink( 'home' )} );
// Set a Body
oMail.setBody("
<p>Dear @user@,</p>
<p>Thank you for downloading @product@, have a great day!</p>
<p><a href='@link@'>@link@</a></p>
");
//send it
var results = mailService.send( oMail );
}
}
Here are my settings from conbox.config:
mailsettings = {
// The default token Marker Symbol
tokenMarker = "@",
// protocol
protocol = {
class = "cbmailservices.models.protocols.CFMailProtocol",
properties = {}
}
};
Do I need anything else in the config file? Won't coldbox pick up username and password from the Lucee settings? Sending emails with <cfmail> works fine btw.
I sure would appreciate any tips or suggestions! Thanks in advance!