Mautic: 500 Internal server error when clicking on link in email

Created on 26 Apr 2018  路  81Comments  路  Source: mautic/mautic

Bug report

Description:

Since last update (2.13.1), link in email do not work. When user click on link, we have a 500 internal server error.
Note the error do not occur if I'm logged in Mautic (but user won't be obviously)...

If a bug:

| Mautic version | 2.13.1
| PHP version | 7.1

Steps to reproduce:

  1. Send an email to someone from Mautic. Insert link in Email
  2. When receiving email, click on the link (usually the link look like http://yourdomain/r/toke&ct=othertoken)

Log errors:

[2018-04-26 15:09:24] mautic.CRITICAL: Uncaught PHP Exception Symfony\Component\Debug\Exception\FatalThrowableError: "Call to a member function getId() on null" at /home/lesaintwebmestre/mautic.lesaint.ca/app/bundles/LeadBundle/Helper/ContactRequestHelper.php line 205 {"exception":"[object] (Symfony\Component\Debug\Exception\FatalThrowableError(code: 0): Call to a member function getId() on null at /home/lesaintwebmestre/mautic.lesaint.ca/app/bundles/LeadBundle/Helper/ContactRequestHelper.php:205)"} []

bug ready-to-test

Most helpful comment

@williamespindola I confirm your patch does the trick.

So you suggest not to check if $this->trackedContact is not null on app/bundles/LeadBundle/Helper/ContactRequestHelper.php but delete the elseif part in /app/bundles/LeadBundle/Tracker/ContactTracker.php between lines 127-129.

I can confirm with @MRG95 that your patch is resolving the issue.

So:

 public function getContact()
    {
        if ($systemContact = $this->getSystemContact()) {
            return $systemContact;
        } elseif ($this->isUserSession()) {
            return null;
        }
        if (empty($this->trackedContact)) {
            $this->trackedContact = $this->getCurrentContact();
            $this->generateTrackingCookies();
        }
        if ($this->request) {
            $this->logger->addDebug('CONTACT: Tracking session for contact ID# '.$this->trackedContact->getId().' through '.$this->request->getMethod().' '.$this->request->getRequestUri());
        }
        // Log last active for the tracked contact
        if (!defined('MAUTIC_LEAD_LASTACTIVE_LOGGED')) {
            $this->leadRepository->updateLastActive($this->trackedContact->getId());
            define('MAUTIC_LEAD_LASTACTIVE_LOGGED', 1);
        }
        return $this->trackedContact;
    }

becomes

```
public function getContact()
{
if ($systemContact = $this->getSystemContact()) {
return $systemContact;
}

    if (empty($this->trackedContact)) {
        $this->trackedContact = $this->getCurrentContact();
        $this->generateTrackingCookies();
    }
    if ($this->request) {
        $this->logger->addDebug('CONTACT: Tracking session for contact ID# '.$this->trackedContact->getId().' through '.$this->request->getMethod().' '.$this->request->getRequestUri());
    }
    // Log last active for the tracked contact
    if (!defined('MAUTIC_LEAD_LASTACTIVE_LOGGED')) {
        $this->leadRepository->updateLastActive($this->trackedContact->getId());
        define('MAUTIC_LEAD_LASTACTIVE_LOGGED', 1);
    }
    return $this->trackedContact;
}

```
as suggested here

Thank you guys!

All 81 comments

| Mautic version | 2.13.1 & 2.13.0

| PHP version | 7.0

I'm getting same errors here.

1) If the user who has mautic admin cookie clicks the mautic link, the user will be redirected to the target url.

2) If the user clicks the same link from another browser (new user), the user can't be redirected and shows error.

Label: Bug

Same error here, this is a catastrophic error as Mautic is completely unusable with this problem.

Hi i have same problem but if I log in in Mautic, the link work and redirect on the destination site. How did you get around the problem?

Mautic version | 2.13.1
PHP version | 7.0

I'm having the same problem! Has anyone come up with a solution?

Looks like this issue is happening only when the email is sent "individually" inside mautic admin.

If the email is sent automatically by forms or campaigns it works.

However if you send email from here:

image

Trackable urls get broke.

For while I have disable trackable urls from at config/edit

Can you guys confirm if the problem is only in case of email sent "individually"

In my case it is also only for individual emails @kauelinden.

This issue occurs even on campaigns for me - but like @ElMandrillo if I'm logged in when I click an email link then it works..

Really bad issue and hasn't happened with any other campaign ?

Seems to be related to file permissions for me..

chown and chmod fixed it.

[Wed May 16 14:53:00.197751 2018] [php7:error] [pid 1312] [client IPWASHERE:6193] PHP Fatal error:  Uncaught UnexpectedValueException: The stream or file "/var/www/folder/app/logs/mautic_prod-2018-05-16.php" could not be opened: failed to open stream: Permission denied in /var/www/folder/app/cache/prod/classes.php:3970\nStack trace:\n#0 /var/www/folder/vendor/monolog/monolog/src/Monolog/Handler/RotatingFileHandler.php(107): Monolog\\Handler\\StreamHandler->write(Array)\n#1 /var/www/folder/app/cache/prod/classes.php(3900): Monolog\\Handler\\RotatingFileHandler->write(Array)\n#2 /var/www/folder/app/cache/prod/classes.php(4402): Monolog\\Handler\\AbstractProcessingHandler->handle(Array)\n#3 /var/www/folder/app/cache/prod/classes.php(4473): Monolog\\Logger->addRecord(400, 'PHP Error: Unca...', Array)\n#4 /var/www/folder/app/bundles/CoreBundle/ErrorHandler/ErrorHandler.php(432): Monolog\\Logger->log(400, 'PHP Error: Unca...', Array)\n#5 /var/www/folder/app/bundles/CoreBundle/ErrorHandler/ErrorHandler.php(245): Mautic\\CoreBundle\\ErrorHandler\\ErrorHandler->log('error', 'PHP Error: Unca...')\n#6 [internal function]: Mautic in /var/www/folder/app/cache/prod/classes.php on line 3970

Did not work for me and on some server, we do not have access to the command line... :(

I also see the problem when sending to a single user through button in right top

app/bundles/LeadBundle/Helper/ContactRequestHelper.php

if ((int) $stat->getEmail()->getId() !== (int) $clickthrough['channel']['email']) {
      // Email ID mismatch - fishy so use tracked lead
      throw new ContactNotFoundException();
}

My solution was to comment this part of code. Now it works!

The links should not be converted to trackables when sending directly to a contact from the contact detail page. Because this way the sent email is not related to any Email entity. That's the bug.

Edit: I can reproduce.

  1. Send email with a link to a contact from the contact detail page.
  2. Click the link in the email you've received.
  3. The error occurs.

@escopecz I'm not sure about that. I think they've traditionally been converted. But in 2.13, the catch was added to check the email ID in a clickthrough to ensure it was the contact to prevent the tracking phishing vulnerability. But in this case, there's no email associated and using the stat itself should suffice. We just need to fix that line to be something like if ($stat->getEmail() && ...

Yeah, I just tested sending an email thru a campaign and the link works fine, but like others, if I send it off of the contact record (individual email), I get the error

@mamutu07 your solution worked. Comment out Line 205

Better change

if ((int) $stat->getEmail()->getId() !== (int) $clickthrough['channel']['email']) {

to

if ($stat->getEmail() && (int) $stat->getEmail()->getId() !== (int) $clickthrough['channel']['email']) {

Can anyone PR that?

Find: app/bundles/LeadBundle/Helper/ContactRequestHelper.php

if ($stat->getEmail() && (int) $stat->getEmail()->getId() !== (int) $clickthrough['channel']['email']) {
            // Email ID mismatch - fishy so use tracked lead
            throw new ContactNotFoundException();
}

I just tested on Mautic v2.13.1 and it works.

+1

I just tested on Mautic v2.13.1 and it works.

Solution didn't work for me. Mautic 2.13.1
I edited app/bundles/LeadBundle/Helper/ContactRequestHelper.php as described above, and cleared cache. Sent a new message (not campain) but links still don't work. Sent an important mail to over 1500 recipient with link failure - that's how I learned the problem was there - cause they work when I am logged in. :/

I think the solution caused another bug.

Today I upgraded to the 2.14.0 version and all links in my campains got broken.

The log pointed to this line:

        if ($this->trackedContact->getId() && $this->trackedContact->isAnonymous()) {
            return $this->leadModel->mergeLeads($this->trackedContact, $foundContact, false);
        }

Now $this->trackedContact is null.

Important! Even for emails sent in the past, all links were broken.

I commented this 矛f` and the links came back to work, but now it seems that double opt-in is not working anymore, becouse there is no track (I think).

Does it make sense?

private function mergeWithTrackedContact(Lead $foundContact)
{
if (!is_null($this->trackedContact))
{
if ($this->trackedContact->getId() && $this->trackedContact->isAnonymous()) {
return $this->leadModel->mergeLeads($this->trackedContact, $foundContact, false);
}
}
return $foundContact;
}

@gustavofoa are you testing links in the same browser you're logged into Mautic as?

The @GabriGreese code works. But the questions is why the trackedContact is null?

@williamespindola Sure, it works, and I'm according with you... Why the trackedContact is null?

I'll inspect the code when possible... and write it my suggestion here soon I hope...

Hi, I just installed Mautic 2.14.0 via Softaculous last night. Having this issue as well for emails sent from campaigns. (Haven't tested manual emails)

Here is my log:

[2018-07-31 11:00:23] mautic.CRITICAL: Uncaught PHP Exception Symfony\Component\Debug\Exception\FatalThrowableError: "Call to a member function getId() on null" at /home/univers6/public_html/mautic/app/bundles/LeadBundle/Helper/ContactRequestHelper.php line 307 {"exception":"[object] (Symfony\\Component\\Debug\\Exception\\FatalThrowableError(code: 0): Call to a member function getId() on null at /home/univers6/public_html/mautic/app/bundles/LeadBundle/Helper/ContactRequestHelper.php:307)"} []

Yep @MRG95,
the community is inspecting why the problem is there.

I suggest a temporary workaround in app/bundles/LeadBundle/Helper/ContactRequestHelper.php, line 307.

Replace

private function mergeWithTrackedContact(Lead $foundContact)
{
if ($this->trackedContact->getId() && $this->trackedContact->isAnonymous()) {
return $this->leadModel->mergeLeads($this->trackedContact, $foundContact, false);
}
return $foundContact;
}

with

private function mergeWithTrackedContact(Lead $foundContact)
{
if (!is_null($this->trackedContact))
{
if ($this->trackedContact->getId() && $this->trackedContact->isAnonymous()) {
return $this->leadModel->mergeLeads($this->trackedContact, $foundContact, false);
}
}
return $foundContact;
}

This is only a temporary workaround, leaving trackedContact object usable if it exists in some situation, and returning $foundContact if it is null.

@GabriGreese Thanks! I have implemented this and it appear to have fixed it. However it does not fix previously sent emails. Those still fail. Is this expected?

Edit:
I am now getting a different error in my log. Pertains to line 173. It's complaining because getId() was called on a null foundContact object. So it's not a great workaround looks like.

@alanhartless the problem arises with this PR #6131 returning null in case the $this->isUserSession returns true, checkout the line code. I think we can remove this elseif verification because the next statement will check if the trackedContact is null and getCurrentContact

@GabriGreese can you test you env with my observations above? Let me know if this works for you too.

@williamespindola I know you didn't ask me but... I reversed the suggested change from @GabriGreese and tried implementing your suggestion, the removal of that elseif. This seems to have resolved my issue. No errors in the log, link functions normally. I'm a total 1 day old noob here so definitely someone else test it too hahaha. Thanks!

@MRG95 my test does not collide with line 173 of your comment above but I believe the problem is larger than a simple verification with is_null.

Could you please attach your corrections here so we can check it?

I think you're not a noob but a useful part of the community.

@williamespindola, I'll check your code as soon as possible, thank you.

@williamespindola I confirm your patch does the trick.

So you suggest not to check if $this->trackedContact is not null on app/bundles/LeadBundle/Helper/ContactRequestHelper.php but delete the elseif part in /app/bundles/LeadBundle/Tracker/ContactTracker.php between lines 127-129.

I can confirm with @MRG95 that your patch is resolving the issue.

So:

 public function getContact()
    {
        if ($systemContact = $this->getSystemContact()) {
            return $systemContact;
        } elseif ($this->isUserSession()) {
            return null;
        }
        if (empty($this->trackedContact)) {
            $this->trackedContact = $this->getCurrentContact();
            $this->generateTrackingCookies();
        }
        if ($this->request) {
            $this->logger->addDebug('CONTACT: Tracking session for contact ID# '.$this->trackedContact->getId().' through '.$this->request->getMethod().' '.$this->request->getRequestUri());
        }
        // Log last active for the tracked contact
        if (!defined('MAUTIC_LEAD_LASTACTIVE_LOGGED')) {
            $this->leadRepository->updateLastActive($this->trackedContact->getId());
            define('MAUTIC_LEAD_LASTACTIVE_LOGGED', 1);
        }
        return $this->trackedContact;
    }

becomes

```
public function getContact()
{
if ($systemContact = $this->getSystemContact()) {
return $systemContact;
}

    if (empty($this->trackedContact)) {
        $this->trackedContact = $this->getCurrentContact();
        $this->generateTrackingCookies();
    }
    if ($this->request) {
        $this->logger->addDebug('CONTACT: Tracking session for contact ID# '.$this->trackedContact->getId().' through '.$this->request->getMethod().' '.$this->request->getRequestUri());
    }
    // Log last active for the tracked contact
    if (!defined('MAUTIC_LEAD_LASTACTIVE_LOGGED')) {
        $this->leadRepository->updateLastActive($this->trackedContact->getId());
        define('MAUTIC_LEAD_LASTACTIVE_LOGGED', 1);
    }
    return $this->trackedContact;
}

```
as suggested here

Thank you guys!

Just to let you know that I was facing this error and the updated code mentioned by @GabriGreese did the trick. When can we expect this fix to be merged?

EDIT: Although it seems that click tracking doesn't seem to be working - anyone else having this issue?

Can also confirm this issue and @GabriGreese's solution fixed it for me.

This is a pretty big issue really.

Hi guys, I have updated the code to reflect @GabriGreese suggestion and links work, but unfortunately, the link tracking is not working anymore. Any suggestions to fix that tracking issue? =/

Thanks a lot.

@franciswagner Test your link tracking in incognito mode. Also make sure you have your tracking pixel script on the page as well.

Thanks @MRG95! It worked! =D

Having the same problem here too.

I removed:

elseif ($this->isUserSession()) {
return null;

from /app/bundles/LeadBundle/Tracker/ContactTracker.php

Which fixed the email link issue but now no tracking is working, so i don't know when a person clicks on an email or visits a page.

Tried this while logged in and logged out of mautic and it's the same. I am using a Mautic Landing Page so the tracking is already included.

I've tried using 'Clicks Email' and 'Visits a Page' but neither are being tracked.

Before removing the code above, when the email links didn't work, I went to the Landing Page manually and it was tracked as expected when using the 'Visits a Page' decision.

Edit....

Forgot to say, this is happening with emails sent from a campaign, I've not tested it with the instant send option on a contact profile as I am very unlikely to ever need to do that.

Also, my Mautic is v2.14.0 and my PHP is 7.0.31

If I put the else if statement back, so I get the 500 error when clicking on links, this is the error log I receive on mautic:

[2018-08-15 17:34:45] mautic.CRITICAL: Uncaught PHP Exception Symfony\Component\Debug\Exception\FatalThrowableError: "Call to a member function getId() on null" at /home/autores/mautic/app/bundles/LeadBundle/Helper/ContactRequestHelper.php line 307 {"exception":"[object] (Symfony\Component\Debug\Exception\FatalThrowableError(code: 0): Call to a member function getId() on null at /home/autores/mautic/app/bundles/LeadBundle/Helper/ContactRequestHelper.php:307)"} []

Just as a test, and to try and rule out PHP7 issues, I just created a new cPanel account with php version 5.6.37 and did a fresh install of Mautic. The problem is exactly the same for that one too.

EDIT....

I tried every solution I could find and nothing worked... So, I download to v2.13.0 and everything is now working fine :)

I did notice that jumping around a campaign isn't available on this version, which is frustrating as I use that a lot. But having workable links and being able to track page hits is much more important.

I got a few warnings when I was installing from the zip file but they were all easily solved. Mostly extensions that needed adding via Apache on WHM.

I'm going to keep the latest release of Mautic on a separate installation and check if this issue is fixed every week or so. When it is I'll upgrade because I do like jumping around in my campaigns!

Another thing that might be a useful tip to anybody reading... you need to be logged out of Mautic for tracking to work, it doesn't track your clicks or page hits when you are logged in as that would lead to false stats. Logging out and in all of the time is a pain, so I am logged in on Chrome, and logged out on Safari. Safari is my default browser so it makes checking clicks to landing pages from emails etc much more user friendly.

Good luck if you are having problems. And a very big thank you to all of the developers. For my business, Mautic is an absolute god send.

Hi guys,
using 2.14.0 here, and this is still a problem right?
I'm getting 2 different errors when someone clicks a link on my campaign:

[2018-08-19 11:39:41] mautic.CRITICAL: Uncaught PHP Exception Symfony\Component\Debug\Exception\FatalThrowableError: "Call to a member function getId() on null" at /var/www/html/app/bundles/LeadBundle/Helper/ContactRequestHelper.php line 307 {"exception":"[object] (Symfony\\Component\\Debug\\Exception\\FatalThrowableError(code: 0): Call to a member function getId() on null at /var/www/html/app/bundles/LeadBundle/Helper/ContactRequestHelper.php:307)"} []

and

[2018-08-19 14:40:46] mautic.CRITICAL: Uncaught PHP Exception Symfony\Component\Debug\Exception\UndefinedFunctionException: "Attempted to call function "bcadd" from namespace "PhpAmqpLib\Wire"." at /var/www/html/vendor/php-amqplib/php-amqplib/PhpAmqpLib/Wire/AMQPWriter.php line 274 {"exception":"[object] (Symfony\\Component\\Debug\\Exception\\UndefinedFunctionException(code: 0): Attempted to call function \"bcadd\" from namespace \"PhpAmqpLib\\Wire\". at /var/www/html/vendor/php-amqplib/php-amqplib/PhpAmqpLib/Wire/AMQPWriter.php:274)"} []

tried every solution above, no one seems to fix the already sent e-mails, which is the real problem to be solved right now.

Not tracking the clicks is not a good option, would make the whole solutions useless since there are another competitors who can just send emails campaigns. Tracking and automating is the big diferencial here.

So, anyone have a way to fix, even if it is with a workaround? I mean, can I get every link generated and redirect to the real links with an apache redirect rule or something like that?

I'm in a hurry to fix that, anyone who could give some idea will be very much appreciated

thks.

On 2.14.0 if you remove:

elseif ($this->isUserSession()) {
return null;

from /app/bundles/LeadBundle/Tracker/ContactTracker.php

as suggested by GabriGreese in this thread.

Then the links work, but not for a new contact on the first click. So you could email your list again saying there was a problem with the link in the previous email and they need to click it twice. Even though it does show a 500 error the first time the link should work fine the second time they click it.

I'm pretty sure this is the same for already sent emails but i've not tested it. I am now running version 2.13.0 until this issue is completely sorted.

thks @stevemautic ,

I've commented the if statement at app/bundles/LeadBundle/Helper/ContactRequestHelper.php:205 and the links for the already sent e-mails are working again., that should do for the moment, as a workaround, but losing the tracking is something that really affects us in a negative way.

It's a production list, so I can't send more e-mails through Mautic anymore, at least not until we are sure that tracking is working correctly. It's a real shame, we were liking it a lot, but you how sensible mailing lists can be, we can not afford the risk of something like this happening again.

Wish the best luck for you guys,
awesome initiative and awesome community too.
Cheers.

I just tested the described issue. It happens only if you are logged in to Mautic. If you try to open the link in an incognito browser or if you log out from Mautic the link works correctly. So this issue has no effect on your contacts.

Mautic do not track users so the stats won't be skewed by admin user testing. So yes, there is this error, but only you as the Mautic admin experience it.

@diegodorgam:

I can't send more e-mails through Mautic anymore

Yes, you can.

Remember these 2 rules of Mautic and you'll solve 95% of your problems:

  1. Have a problem? Clear cache.
  2. Always test tracking in an incognito browser window.

BTW the fix for this is here: https://github.com/mautic/mautic/pull/6441

Hi @escopecz thank you for the link, I have a question about the fix.

I have reinstalled 2.14.0 and applied the changes to app/bundles/LeadBundle/Helper/ContactRequestHelper.php

This has fixed the 500 error problem. I don't get the error at all now, for new contacts or existing contacts. And all links are working, and being tracked as expected.

But what are the other files changes for?
the file is referenced as app/bundles/CoreBundle/Tests/unit/IpLookup/MaxmindDownloadLookupTest.php

I'm assuming this is this file...
app/bundles/CoreBundle/IpLookup/MaxmindDownloadLookup.php

I tried to update it as suggested but this stopped me from being able to access mautic at all. I put the original MaxmindDownloadLookup.php file back and everything seems fine. Can you please confirm whether or not changes are needed for this file.

Thank you.
Steve

@diegodorgam

With the changes that @escopecz has linked to my version of 2.14.0 is now working fine. The changes that I made are in this file:

app/bundles/LeadBundle/Helper/ContactRequestHelper.php

Just change line 307 from this:

if ($this->trackedContact->getId() && $this->trackedContact->isAnonymous()) {

to this:

if ($this->trackedContact && $this->trackedContact->getId() && $this->trackedContact->isAnonymous()) {

After making this change I no longer get the 500 error at all, and the links are tracking correctly. When checking your installation be sure you are not logged in to mautic on the same browser that you are testing from. I'm using Safari to check my links etc, and I'm logged in on Chrome, or you can just use private/incognito mode.

Good question. Please ignore changes in app/bundles/CoreBundle/Tests/unit/IpLookup/MaxmindDownloadLookupTest.php. It's just a unit test fix. Not important or even related to this issue.

Just apply the change in app/bundles/LeadBundle/Helper/ContactRequestHelper.php.

Thanks for the confirmation :)

This patch does not solve the problem for me.
Taking a look to ContactRequestHelper, I guess $this->trackedContact should be initialised even is contact is not found (and return true to $this->trackedContact->isAnonymous() )

The problem should be in $this->trackedContact = $this->contactTracker->getContact();
which should return an object everytime and don't.

I simply cannot thank enough for this fix...

For now I'm eager to close this issue as it appears to solve the issue for some.

@yanncharlou it sounds like you have ideas to improve what was merged in $6441, would you put in a follow-up PR?

Same problem here....
I'm using the version v2.14.0

I've tried ALL of the above possibilities...

Why is this closed?

I had it fixed but, after upgrade to 2.14.0 is failing again.

I have applied the modification to app/bundles/LeadBundle/Helper/ContactRequestHelper.php

and it still reports a error 500 (in a incognite chrome). It register the hit to the page, so the flow can continue, but the user gets the error 500.

Any idea?

@stevemautic

How did you fix it in 2.14?

Modifying app/bundles/LeadBundle/Helper/ContactRequestHelper.php doesn't work for me.

It worked in previous version, but no in 2.14

@Carlos-mb that's all I did. I hadn't checked in Chrome, only Safari, but I just checked and didn't get the 500err. My form is on http://freehypnosislessons.com/ if you want to see if it works for you.

The changes I applied to the ContactRequestHelper.php file are the ones on this page:
https://github.com/mautic/mautic/pull/6441/files

I know there have been other suggested changes too, so make sure you're following the correct ones. I'm pretty sure that I didn't change anything else. It was on a fresh install of 2.14 so maybe there is a difference with upgrading and installing from scratch?

I am still having trouble with Mautic though, I can't get it to connect to any email service. But I think this is an issue with IPv6... which my hosting provider doesn't support! I'm with Namecheap, on a dedicated server and nothing I try allows me to connect to any email service. I can send using PHP but then all my emails end up in spam. So I'm holding out on using Mautic until I can connect to Amazon SES.

What method are you using to send email? Are you able to connect to SES? If so who is your hosting provider? I'm not happy with Namecheap so thinking of moving.

@stevemautic you'll have to ask your hosting provider if they allow outbound SMTP sending. One of my hosters didn't so I had to switch hosters to OVH

@stevemautic I have changed ContactRequestHelper and 2.14.0 is giving 500 error.

This is the log:

[2018-09-15 17:20:03] mautic.ERROR: CAMPAIGN: An exception occurred while executing 'REPLACE INTO maujs_campaign_lead_event_failed_log( log_id, date_added, reason) SELECT id, :dateAdded as date_added, :message as reason from maujs_campaign_lead_event_log WHERE is_scheduled = 1 AND lead_id = :contactId AND campaign_id = :campaignId AND rotation = :rotation': You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ':dateAdded as date_added, :message as reason from maujs_campaign_lead_event_log ' at line 2 [] []

Maybe a problem with database.

I have commented these lines in /app/bundles/CampaignBundle/Entity/LeadEventLogRepository.php

(Line 559 )
$connection = $this->getEntityManager()->getConnection();
//\$stmt = $connection->prepare($sql);
//$stmt->bindParam('dateAdded', $dateAdded, \PDO::PARAM_STR);
//$stmt->bindParam('message', $message, \PDO::PARAM_STR);
//$stmt->bindParam('contactId', $contactId, \PDO::PARAM_INT);
//$stmt->bindParam('campaignId', $campaignId, \PDO::PARAM_INT);
//$stmt->bindParam('rotation', $rotation, \PDO::PARAM_INT);
//\$stmt->execute();

It's not updating the LeadEventLogRepository table ... but it wasn't doing it anyway.

Now does not report the error 500... I'll uncomment them when the error will be fixed

@MRG95 Thanks for the tip, IU've just asked them, so waiting for a support ticket update to see if this is the issue.

I can send via PHP mail without any problems at all, but when I test this to various email accounts I have they always end up in spam. Hotmail, Gmail and Yahoo all send emails I send via PHP mail direct to spam, which completely cripples my list. So PHP mail is not really an option.

My problem now is actually connecting to a mail service. I set up SES but it will not connect. And the same with Gmail. I can't set up a working AAAA record on my nameservers as Namecheap doesn't yet support IPv6... so I'm assuming this might be my problem.

@Carlos-mb Your error code does look like a problem with the database, I don't know enough to advise you here, but I would try to set up a fresh install of 2.14.0 on a sub domain, with a fresh database then make the changes to the ContactRequestHelper file and test it.

If your old database was set up with an older version of mautic before you upgraded then maybe something is different.

If the fresh install doesn't work then I'd assume it's something to do with your server set up. I had to make a few changes on my server for other problems so I know that my default settings were causing issues.

I can't remember which ones, but I know I had to install a couple of file extensions on my server to fix another problem so it could be something like that.

Just in case anybody has the same error (not connecting to Amazon SES) I mentioned in my previous post (although not the subject of this thread!) here is my solution...

When you try to connect to SES you get this error message....

Connection could not be established with host email-smtp.us-east-1.amazonaws.com [Connection refused #111]

How to solve...

I changed the port used my Amazon to 587 by doing this:

app/bundles/EmailBundle/Swiftmailer/Transport/AmazonTransport.php

line 71 > parent::__construct($host, 2587, 'tls');
change to > parent::__construct($host, 587, 'tls');

Then in WHM > ConfigServer Security and Firewall > Firewall Configuration >IPv4 Port Settings

I made sure 587 was in TCP_IN and TCP_OUT

Then I added 587 to SMTP_PORTS (block list) at ConfigServer Security and Firewall > Firewall Configuration > SMTP Settings

Then added my Cpanel username for the account where I have Mautic installed and the Amazon SMTP (for me it is email-smtp.us-east-1.amazonaws.com) to my SMTP_ALLOWUSER and SMTP_ALLOWGROUP lists (the next item under SMTP_PORTS)

Now it connects fine :)

For some reason, when I was using port 2587 it kept removing itself from TCP_IN and TCP_OUT, which is why I changed to port 587. I also read on Amazons site that port 25 can cause problem so chose 587

I know this is off topic for this thread but hope it can help anybody also struggling with SES connection problems.

@stevemautic, thanks for the idea

I have executed /mautic/s/update/schema and it says that database is up to date.

The log file reports a "sintax error" in SQL query. I'm not sure it's a database structure problem.

I'll wait for 2.14.1 and see..

Still fails in 2.14.1

Is there any way I could check and repair database?

EDIT: I have manually updated Database structure and still fails... as I described in
This comment

The issue persists after update to 2.14.1
Any idea?

_Please check for related errors in the latest log file in [mautic root]/app/log/ and/or the web server's logs and post them here. Be sure to remove sensitive information if applicable._

@EduLeonPavon change the SQL Driver. It has worked for me rght now

'db_driver' => 'pdo_mysql',

In app/config/local.php

Regards

@EduLeonPavon change the SQL Driver. It has worked for me rght now

'db_driver' => 'pdo_mysql',

In app/config/local.php

Regards

Thank you @Carlos-mb . Unfortunately, no effect :-(

Did you empty cache after change the driver?

Did you copy link and paste in a "incognigto" tab?

Did you empty cache after change the driver?

Did you copy link and paste in a "incognigto" tab?

Yes; no changes. It麓s really frustrating receive 10-20 emails every day from users with a subject like "The link is broken".

@EduLeonPavon I'm quite sure that your problem is not the same that this issue is about. Get the error message from the logs (how to: https://www.mautic.org/docs/en/tips/troubleshooting.html) and create new issue.

Did you empty cache after change the driver?
Did you copy link and paste in a "incognigto" tab?

Yes; no changes. It麓s really frustrating receive 10-20 emails every day from users with a subject like "The link is broken".

Have you seen the workaround I applied?

https://github.com/mautic/mautic/issues/6008#issuecomment-421615440

The table that is not populated because of the error is just a log, so, no much relevant.

Closing this issue as the original issue has been solved and released in 2.14.1. Create new issues for other specific problems.

@EduLeonPavon I'm quite sure that your problem is not the same that this issue is about. Get the error message from the logs (how to: https://www.mautic.org/docs/en/tips/troubleshooting.html) and create new issue.

@escopecz you are right. The problem was in the url with spanish accents. It seems that Mautic have problems with tracking of url麓s with accents.

I麓ve created a new url with bit.ly to mask the destiny url with accents.

Thanks everyone.

This problem is happened only if you are logged in Mautic (if exists cookie)

Yo lo pude resolver. Es decir tengo la ultima versi贸n 2.14.2, y me paso lo mismo. Yo lo resolv铆 sacando acentos o caracteres raros ( 帽 ) en la secci贸n categor铆as.

No es necesario quitar acentos de los asuntos, solo modifica las categor铆as. Al menos me funcion贸 as铆.


I could solve it. That is, I have the latest version 2.14.2, and the same thing happened to me. I solved it by extracting accents or rare characters (帽) in the categories section.

It is not necessary to remove accents from the issues, just modify the categories. At least it worked like that.

mautic

so, tried that, it will only work while logged in.
When I log out mautic, the same 500 error come back...
anyone got how to solve this issue? shouldn't it be reopened?

@diegodorgam it depends whether you have the same error Call to a member function getId() on null in the logs. If so then tell us what version do you run and we can reopen if it's 2.14.1+. If it's another error then create new issue, please.

@escopecz my mautic version is 2.14.2, running the latest docker image.
the logs show this:

[2018-12-07 15:45:41] mautic.CRITICAL: Uncaught PHP Exception Symfony\Component\Debug\Exception\FatalThrowableError: "Call to a member function getId() on null" at /var/www/html/app/bundles/LeadBundle/Helper/ContactRequestHelper.php line 173 {"exception":"[object] (Symfony\\Component\\Debug\\Exception\\FatalThrowableError(code: 0): Call to a member function getId() on null at /var/www/html/app/bundles/LeadBundle/Helper/ContactRequestHelper.php:173)"} []

tried commenting lines indicated in comments above, but it will just start breaking other stuff...

And this only happens when I'm not logged in mautic...

I believe this is different place than the original error. Even though in the same file. Could you create new issue with steps to replicate, please?

Mautic version v2.14.2
have this issue, when login in Mautic is required for redirect links to work. Unable to send emails with enabled tracking. Could anyone provide with an update on this issue?

@ArtemDzhafarov please upgrade to the latest version where it's fixed. No reason to report issues on outdated versions.

Version 2.14.0 - logout in Mautic solved my problem...

Was this page helpful?
0 / 5 - 0 ratings