Ok I have an issue where the below code seems to be not working correctly, and I have no idea why.
The thing to note is that the log contains the right email, but the email is sent with the wrong email for some unknown reason.
log.info(“Out email : #settings.cb_site_outgoingEmail#”);
var mail = mailservice.newMail(to = email,
from = settings.cb_site_outgoingEmail,
subject = “Test”,
bodyTokens = bodyTokens,
type = “html”,
server = settings.cb_site_mail_server,
username = settings.cb_site_mail_username,
password = settings.cb_site_mail_password,
port = settings.cb_site_mail_smtp,
useTLS = settings.cb_site_mail_tls,
useSSL = settings.cb_site_mail_ssl);
mail.setBody( renderer**.get().renderExternalView(view="/**contentbox/email_templates/test") );
mailService.send( mail );