Mailgate not working: Could not record email: Could not load a valid user

Dear all,

I am very new to RT and just setup RT 4.2.6 on a Centos 6 VM machine which
has an old copy of Qmail running. Installation went fine and now I can
create Tickets and Reply to Tickets via the Web interface at:
http://my.company.com/rt/.

However, I am having problems while trying to create Tickets via Email.

While sending email via Mailgate using the command below:

(echo from: rt@gmail.com Subject: test; echo; echo test) |
/opt/rt/bin/rt-mailgate --queue General --action correspond --url
http://my.company.com/rt --debug

I see the following errors on the screen:

/opt/rt/bin/rt-mailgate: temp file is ‘/tmp/yBDiQmLWn3/D5Z8PB7NBF’
/opt/rt/bin/rt-mailgate: connecting to
http://my.company.com/rt/REST/1.0/NoAuth/mail-gateway
not ok - Could not load a valid user

In the rt.log, I see the following:

[Wed Aug 6 07:27:53 2014] [debug]: Encode::Guess guessed encoding: ascii
(/opt/rt/sbin/…/lib/RT/I18N.pm:595)
[Wed Aug 6 07:27:53 2014] [debug]: Encode::Guess guessed encoding: ascii
(/opt/rt/sbin/…/lib/RT/I18N.pm:595)
[Wed Aug 6 07:27:53 2014] [error]: Unable to parse an email address from
rt@gmail.com Subject: test
: rt@gmail.com Subject: test
is not a valid email address (/opt/rt/sbin/…/lib/RT/EmailParser.pm:540)
[Wed Aug 6 07:27:53 2014] [debug]: Converting ‘ascii’ to ‘utf-8’ for
text/plain - Subjectless message (/opt/rt/sbin/…/lib/RT/I18N.pm:295)
[Wed Aug 6 07:27:53 2014] [warning]: Use of uninitialized value
$NewSubject in scalar chomp at /opt/rt/sbin/…/lib/RT/Interface/Email.pm
line 1350. (/opt/rt/sbin/…/lib/RT/Interface/Email.pm:1350)
[Wed Aug 6 07:27:53 2014] [error]: Couldn’t parse or find sender’s address
(/opt/rt/sbin/…/lib/RT/Interface/Email/Auth/MailFrom.pm:74)
[Wed Aug 6 07:27:53 2014] [error]: Could not record email: Could not load
a valid user (/opt/rt/share/html/REST/1.0/NoAuth/mail-gateway:75)

I did some searches for this error which says there is some
mis-configuration in the Apache settings or not providing rights for
Everybody in the General Queue to create and reply to Tickets. I have tried
the help and solutions listed but still facing the same problem.

I have also granted both Create and Reply rights to Everybody and
Unprivileged for the General Queue.
Regarding the Apache Web config, I have the following:

AddDefaultCharset UTF-8
Alias /rt/NoAuth/images /opt/rt/share/html/NoAuth/images/
ScriptAlias /rt /opt/rt/sbin/rt-server.fcgi/

DocumentRoot “/opt/rt/share/html”
<location /rt>
Order allow,deny
Allow from all
Options +ExecCGI
AddHandler fcgid-script fcgi

Regarding my RT_SiteConfig.pm configuration, it is listed as below:

Set( $rtname, ‘my.company.com’);
Set($WebPath, “/rt”);
1;

Set(@ReferrerWhitelist, qw(www.example.com:443 1.2.3.4:80 my.company.com:80
));
Set($Organization, “my.company.com”);
Set($WebBaseURL, “http://my.company.com”);
Set($WebDomain, ‘my.company.com’);
Set($CorrespondAddress, ‘correspond@my.company.com’);
Set($CommentAddress, ‘comment@my.company.com’);
Set($OwnerEmail, “admin@my.company.com”);

Set($LogToSyslog , ‘info’);
Set($LogToFile , ‘debug’); #debug is very noisy
Set($LogDir, ‘/opt/rt/var/log’);
Set($LogToFileNamed , “rt.log”); #log to rt.log

Set($WebRemoteUserAuth , 0);
Set($WebFallbackToRTLogin , 1);
Set($SenderMustExistInExternalDatabase , 0);
Set($AutoCreateNonExternalUsers , 1);

What could be the problem here?
Any help will be very much appreciated.

Thanks,
Best Regards,
Tek Limbu

The debug log is saying that “rt@gmail.com Subject: test” is not a valid
email address. The line that you are using to send a test email appears to
be missing a newline. Try this:

(echo “From: rt@gmail.com” ; echo “Subject: test” ; echo ; echo “test”) |
/opt/rt/bin/rt-mailgate --queue General --action correspond --url
http://my.company.com/rt --debugOn 6 August 2014 17:43, Tek Bahadur Limbu teklimbu@gmail.com wrote:

Dear all,

I am very new to RT and just setup RT 4.2.6 on a Centos 6 VM machine which
has an old copy of Qmail running. Installation went fine and now I can
create Tickets and Reply to Tickets via the Web interface at:
http://my.company.com/rt/.

However, I am having problems while trying to create Tickets via Email.

While sending email via Mailgate using the command below:

(echo from: rt@gmail.com Subject: test; echo; echo test) |
/opt/rt/bin/rt-mailgate --queue General --action correspond --url
http://my.company.com/rt --debug

I see the following errors on the screen:

/opt/rt/bin/rt-mailgate: temp file is ‘/tmp/yBDiQmLWn3/D5Z8PB7NBF’
/opt/rt/bin/rt-mailgate: connecting to
http://my.company.com/rt/REST/1.0/NoAuth/mail-gateway
not ok - Could not load a valid user

In the rt.log, I see the following:

[Wed Aug 6 07:27:53 2014] [debug]: Encode::Guess guessed encoding: ascii
(/opt/rt/sbin/…/lib/RT/I18N.pm:595)
[Wed Aug 6 07:27:53 2014] [debug]: Encode::Guess guessed encoding: ascii
(/opt/rt/sbin/…/lib/RT/I18N.pm:595)
[Wed Aug 6 07:27:53 2014] [error]: Unable to parse an email address from
rt@gmail.com Subject: test
: rt@gmail.com Subject: test
is not a valid email address (/opt/rt/sbin/…/lib/RT/EmailParser.pm:540)
[Wed Aug 6 07:27:53 2014] [debug]: Converting ‘ascii’ to ‘utf-8’ for
text/plain - Subjectless message (/opt/rt/sbin/…/lib/RT/I18N.pm:295)
[Wed Aug 6 07:27:53 2014] [warning]: Use of uninitialized value
$NewSubject in scalar chomp at /opt/rt/sbin/…/lib/RT/Interface/Email.pm
line 1350. (/opt/rt/sbin/…/lib/RT/Interface/Email.pm:1350)
[Wed Aug 6 07:27:53 2014] [error]: Couldn’t parse or find sender’s
address (/opt/rt/sbin/…/lib/RT/Interface/Email/Auth/MailFrom.pm:74)
[Wed Aug 6 07:27:53 2014] [error]: Could not record email: Could not load
a valid user (/opt/rt/share/html/REST/1.0/NoAuth/mail-gateway:75)

I did some searches for this error which says there is some
mis-configuration in the Apache settings or not providing rights for
Everybody in the General Queue to create and reply to Tickets. I have tried
the help and solutions listed but still facing the same problem.

I have also granted both Create and Reply rights to Everybody and
Unprivileged for the General Queue.
Regarding the Apache Web config, I have the following:

AddDefaultCharset UTF-8
Alias /rt/NoAuth/images /opt/rt/share/html/NoAuth/images/
ScriptAlias /rt /opt/rt/sbin/rt-server.fcgi/

DocumentRoot “/opt/rt/share/html”
<location /rt>
Order allow,deny
Allow from all
Options +ExecCGI
AddHandler fcgid-script fcgi

Regarding my RT_SiteConfig.pm configuration, it is listed as below:

Set( $rtname, ‘my.company.com’);
Set($WebPath, “/rt”);
1;

Set(@ReferrerWhitelist, qw(www.example.com:443 1.2.3.4:80
my.company.com:80));
Set($Organization, “my.company.com”);
Set($WebBaseURL, “http://my.company.com”);
Set($WebDomain, ‘my.company.com’);
Set($CorrespondAddress, ‘correspond@my.company.com’);
Set($CommentAddress, ‘comment@my.company.com’);
Set($OwnerEmail, “admin@my.company.com”);

Set($LogToSyslog , ‘info’);
Set($LogToFile , ‘debug’); #debug is very noisy
Set($LogDir, ‘/opt/rt/var/log’);
Set($LogToFileNamed , “rt.log”); #log to rt.log

Set($WebRemoteUserAuth , 0);
Set($WebFallbackToRTLogin , 1);
Set($SenderMustExistInExternalDatabase , 0);
Set($AutoCreateNonExternalUsers , 1);

What could be the problem here?
Any help will be very much appreciated.

Thanks,
Best Regards,
Tek Limbu


RT Training - Boston, September 9-10
http://bestpractical.com/training