Sending email to RT returns HTML

I’ve moved an existing instance of RT over to RHEL. I’m trying to get email tickets to work. I’ve confirmed that the tickets get picked up from the Gmail account but they don’t get created in RT.

Simplifying it down to the command line, when I put in this
(echo “From: XXXXX@yavapai.us” ; echo “Subject: test from command line” ; echo ; echo “test”) |/var/www/requesttracker/bin/rt-mailgate --queue ‘YLN’ --action correspond --url http://helptest.yln.info/requesttracker --debug

I get this:

    The RT server which handled your email did not behave as expected. It
    said:

and then it returns the HTML of the home page.

Any idea what might cause this?

What happens if you talk directly to:

http://helptest.yln.info/requesttracker/REST/1.0/NoAuth/mail-gateway

using a web browser? That should be the URL that rt-mailgate ends up using so you can see what it generates or if it does lots of redirects (rt-mailgate can do three levels of redirection on a URL IIRC).

In Firefox, it says “The page you requested could not be found.” I also did it in Edge (who knows why) and it loads the home page.

Here’s what the Apache logs show:

[41270] [Wed Aug 21 18:38:20 2019] [notice]: Marking original destination as having side-effects before redirecting for login.
Request: /requesttracker/REST/1.0/NoAuth/mail-gateway
Reason: your browser did not supply a Referrer header (/var/www/requesttracker/sbin/../lib/RT/Interface/Web.pm:438)

I tried accessing the URL on the working production site and it returns:
not ok - Couldn’t parse or find sender’s address

Do you have anything in the RestrictReferrer option in RT_SiteConfig.pm? If so, does it match the new server you’re using (if the config came from the old machine it might need changing for example).

I do not have RestrictReferrer in my RT_SiteConfig. I’ve double checked that I’ve updated all the settings in there. Should I have RestrictReferrer?

No not necessarily - I just wanted you to check that there wasn’t a restriction from the old server.

Hmm, rather stumped I’m afraid. Its odd that the two different browsers behaved differently. I think if I were in this situation I’d carefully check all the web server configs and if this didn’t threw up anything, install RT again (from the 4.4.4 source rather than a distro RPM/APT) into /opt/rt4 so that its away from the rest of the web server’s document tree and see if that works better.