I am going insane with what would have to be some of the wierdest behaviour I’ve ever come across.
I’ve had a mail service running fine… made a few changes to it recently to get it working inside a thread and try/catch block… was working OK, then started getting an error that the newMail object couldn’t be found when attempting to work with it… tried to dump/abort out the newMail object, and the process worked fine and emails sent… (didn’t dump or abort… which was wierd). But if I remove the writeDump();abort;, it works fine… Have been going in circles on this all day.
Here is the email send script"
`
sendEmail = mailService.newMail(
from = attributes.signature.getEmailAddress(),
to = Application.settings.testemail,
subject="#attributes.prc.org.getName()# - Membership Renewal",
type = “html”
);
sendEmail.addMailPart(charset=‘utf-8’,type=‘text/plain’,body=attributes.Renderer.renderLayout(layout=“email/signatureEmail”, args={rc=attributes.rc}));
sendEmail.addMailPart(charset=‘utf-8’,type=‘text/html’,body=attributes.Renderer.renderLayout(layout=“email/signatureEmail”, args={rc=attributes.rc}));
sentEmail = mailService.send(sendEmail);
`
I get error that sendEmail doesn’t exist at first sendEmail.addMailPart etc… So I tried adding writeDump (see below) expecting it to dump out writeDump, or tell me it wasn’t there, BUT the emails just sent fine… don’t even dump and abort…
`
sendEmail = mailService.newMail(
from = attributes.signature.getEmailAddress(),
to = Application.settings.testemail,
subject="#attributes.prc.org.getName()# - Membership Renewal",
type = “html”
);
writeDump(sendEmail);abort;
sendEmail.addMailPart(charset=‘utf-8’,type=‘text/plain’,body=attributes.Renderer.renderLayout(layout=“email/signatureEmail”, args={rc=attributes.rc}));
sendEmail.addMailPart(charset=‘utf-8’,type=‘text/html’,body=attributes.Renderer.renderLayout(layout=“email/signatureEmail”, args={rc=attributes.rc}));
sentEmail = mailService.send(sendEmail);
Enter code here…
`
I’m about to loose my mind with this one… is there something I am missing here, or are some really weird gremlins screwing with my mind???
Many Thanks to anyone that can save my sanity.
Jason