My Mautic version is: 3.0.3
My PHP version is: 7.3.20
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.
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.
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.
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.
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.