Hey all, I've been facing this problem for the past months when using modMail. I don't know if any of you ever had this but it seems that modMail gets processed asynchronously to the normal modx function. Lets say I populate the content with a chunk and in that chunk there is a snippet that needs to be run, I would say 60% of the time the process fails leaving empty space and sometime even unmodified placeholder.
The issue is very inconsistent. With the same data I get different result.
I would like to mention aswell, that when I send the content of the email in the error log, all the information gets processed normally.
Thanks
Mark
Marc-Andre Audet
Are you getting the chunk with $modx->getChunk()?
[ed. note: BobRay last edited this post 12 years, 6 months ago.]
Normally all the tags in the chunk would be parsed during that operation, unless they're called uncached. In that case the processing of the tags is delayed until just before the page is rendered, which in your case never happens.
You could try an extra processing step after the getChunk() call.
$content = $modx->getChunk("SomeChunk");
$tempChunk = $modx->newObject('modChunk');
$tempChunk->setContent($content);
$tempChunk->setCacheable(false);
$tempChunk->process();
$content = $tempChunk->getContent();
Actually, I am currently setting up a custom form / auto responder for one of my client and I want to use this technique to grasp the auto responder content and process the custom field taken from the form.
I have also tried this and it s not working either.
I am suspecting it is a problem with modMail. SMTP is not turned on aswell.
Marc-Andre Audet
I can almost guarantee that the problem is not with modMail. modMail will send whatever you give it. It does no parsing at all, so you need to make sure all parsing of tags is done before handing off the content to modMail.
Let me review if I pass my associative array right but I feel that modMail might fire before without waiting for my snippet to fully parse my chunks.
Marc-Andre Audet
Ok! Hey all. I just want to apologize for the mislead debug. I finally found the problem which had nothing to do with modMail. Actually, I was passing my values through formit and as I was outputing my value in the the snippet placeholder they also got processed there!
So yes Bob it was a parsing error on my side.
Thanks and good day everybody
Marc-Andre Audet
I'm glad you got it sorted.