Can't Create E-mail. Spinning Notification After Clicking "Apply"

Your software
My Mautic version is: 3.0.3
My PHP version is: 7.3.20

Your problem
My problem is:
I can’t create an e-mail. I go to Channels->emails. I select “New Segment E-mail”. I select a template, enter Builder. Whether I edit anything about the template or not, when I select “Apply”, I get the spinning icon in the apply button, and it hangs permanently.

These errors are showing in the log:
[11-Aug-2020 14:00:49 America/New_York] PHP Notice: Undefined offset: 1 in /home/savabsoq/public_html/musocrm/marketing/app/bundles/EmailBundle/Helper/MailHelper.php on line 1935

Steps I have tried to fix the problem:
None really. The site is hosted on my external host, and I can’t install on my local machine to debug, as I’d need to downgrade my PHP version.

So I am looking at this:

and here is the code in question:

line 1935 [$email, $domain] = explode(‘@’, $settings[‘address’]);

So looking at that I would ask that you check your settings regarding your monitoring email. Is it a proper email or is it set at all? Does it have the @ in it (which is where this explode function is splitting the string)? If that is fine I would consider maybe the PHP version not being good for the way they are using explode here but that’s a wile and could be wrong guess.

Thanks for the reply. Yes, I too looked at that line of code and that prompted me to check on the monitoring address. I do have a valid address there. I also traced back to the “isMontoringEnabled” function, and didn’t see anything obvious there.

Good point about the explode function. That function hasn’t changed since PHP 4 though. It’s definitely something inside that function, though. It must be the $settings[‘address’] that’s invalid. I wish I could debug on this end, but downgrading my PHP would break other stuff on my machine. I’ll investigate further when I get a chance, unless somebody else comes up with it before!

Ok, then can you erase the email in that setting rewrite the email from scratch manaully and type it into the setting field? Perhaps you copied the email from somewhere and the @ sign is a different charset or possibly messed up. Its not the first time its happened to me. Also make sure no white space at the end or beginning. I would even suggest the code here should have a trim if I were a Mautic dev unless that happens when saving the email setting.

FYI: Unless you were looking for an issue with $settings further up the stack I don’t think it has to do with $this->isMontoringEnabled because the fact it says undefined offset and mentions that line. Offset is the #1 key of either the array result of splitting at @ or $settings[‘address’] “address”. Which means it never split it and came up with nada from the explode function or the key address is not existing. At least that’s my best guess not being able to actually var_dump($settings[‘address’]) or the result.

Also this is the monitoring email setting not the other email settings in Mautic config right?

One more thing. Can you use the chrome inspector to inspect the settings of Mautic for this setting and see if the form mentions ‘address’? I am not sure but usually these settings have the same index for the form field in some way. I would do it myself but I have not upgraded to Mautic 3 yet. I am always wary of the first 2-6 versions of a new major version of any software.

Yes. I’m assuming that the $settings[‘address’] is not set at this point, so the issue is further up the stack.

I have the same address in all the e-mail fields. I’ll try to attach screen shots:


I just tried doing an error_log() of the $settings[‘address’] value, but it’s not showing anything in the error log.

For Sh*ts and giggles can you set the custom return address and see of the error goes away?

If that is the issue and its supposed to be optional then the dev team is missing an empty() or isset() further up the stack or in this line of code to skip it and default to whatever is supposed ot be default.

Sure. Just tried that. Same effect.

For more Sh*ts and Giggles can you set use custom connection settings and use the same email settings. My attempt to see if they are not handling “use same settings” case. If this gives the same error I am stumped unless I can find time to reproduce and debug in my server. I’m not upgrading to 3 for another 2 weeks though and who knows if I will encounter the same issue.

Actually one more big thing to do. I have had MANY issues with Mautic cache and when I cleared the case everything worked. This includes issues I have had with settings.

OK. I’ll try clearing the cache now. I did use custom connection settings in the “Bounces” section. It successfully retrieved my mailbox list. No change though.

By the way, the log I’m searching is my server log, not the Mautic log. That’s showing empty. Where do I clear the cache?

This may be for Mautic 2x (although might be same for 3x) and it requires FTP or SSH access:

:slight_smile: I was just looking at that page myself. There is no cache directory under app in my installation.

Incidentally, the error I’m getting in my server log is a notice, not even a warning or critical. It shouldn’t stop execution.

I don’t know where its supposed to be in 3x. Might try adding one there and giving it the right perms. If it doesn’t auto generate files there then they must have moved it in 3x. It cant hurt to add the folder.

Then make sure your server php.ini/user.ini or wherever you can set it is set to suppress notices. You may be encountering this because your display errors is on and your outputting notices.

I also have a javascript warning (not error) in the console of my web browser:

“Editor should be initialized before calling the destroy method.” In froaler_editor.js line 321

I’m pretty sure it must be set to ERROR_REPORTING=off, but I’ll check. Thanks for the suggestions.

check the phpinfo() in the Mautic system settings also in that same page check the folder and file permissions tab.

Hmm. It seems I’d already created one there. I must have been down this route before. :slight_smile:

Interestingly:
display_errors On On