Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parallel install: 1.7.3 sends mails ok, 1.9.3 sends blank mails #1217

Closed
fredastaire opened this issue Sep 3, 2014 · 12 comments
Closed

Parallel install: 1.7.3 sends mails ok, 1.9.3 sends blank mails #1217

fredastaire opened this issue Sep 3, 2014 · 12 comments

Comments

@fredastaire
Copy link

I have two paralel installations of OSTicket in the same server, one of them sends properly formed mails while the other doesn't, which I find really weird.
They run different versions of OSTicket:

  • 1.7.3 --> Can send emails just fine.
  • 1.9.3 --> Brand new install, it sends blank mails, either to gmail or outlook mailboxes.

Here are some examples:

  • With the new account details mail or when I go use the test outgoing mail feature. In both cases it sends a complete blank mail. And in both the email is similar (sensitive info masked as *****):

To: < * >
Subject: Welcome to osTicket
X-PHP-Originating-Script: 48:mail.php
Content-Type: multipart/alternative;
boundary="=_e4b00c2a7b0774422f62ccb3551b0dbf"
MIME-Version: 1.0
From: osTicket Alerts <alerts@
>
Date: Tue, 2 Sep 2014 19:31:28 +0200
Message-ID: <5ab1fd8fa-qVkd9doY3-alerts@
>
X-Mailer: osTicket Mailer
Return-Path: apache@
**
X-OriginalArrivalTime: 02 Sep 2014 17:31:29.0369 (UTC) FILETIME=[BAEF7C90:01CFC6D3]
X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrDLMWRmVeSWpSXmKPExsUyM+Jvje6nf6whBitPy1u8e9zA5sDosXPW XfYAxigum5TUnMyy1CJ9uwSujE3P3zAVTGeqODjxHGMD42/GLkYODgkBE4mfT7O6GDmBTDGJ
C/fWs4HYQgJHGSXeztfrYuQCsrczSvxe3MQG4axhlJjxo58doqqRUaLvjBCILSIgK7Fvey8j
iC0sICOx9sRWdoipqhLzt3xgA1nGLBAiMeuRFEiYV0BQ4uTMJywgNhvQDV/af4K1sgioSCw6
94UZosZO4vrO60wQYyQlbn45xwSx1kji/NY9LBDxYInTdzpZJzAKzkLYMAvJBhCbWUBRYkr3
Q3aIEk2J9bv0UYVBbA2J1jlz2Rcwsq1iFC1OLS7OTTcy1kstykwuLs7P08tLLdnECAzug1t+
6+5gXP3a8RCjAAejEg/vAhXWECHWxLLiytxDjNIcLErivIvOzQsWEkhPLEnNTk0tSC2KLyrN
SS0+xMjEwSnVwDhNhH3Ouxxt5oT2lcXpCtqb1r+fnLeP+wrTtIOMLF4CytNPuj2KvFP5fAWb
suSMnz79x5c5yTbWd6fFHDLPOx1/T8qwckN0zMlGQx3ZeTZz7dp69ae2BeZXdHqdCd1q+rF4
1ssI9slrmRc/OObfPoP9QYGPAufE+MMLbgocSV4dqaa7bNWtMiWW4oxEQy3mouJEAPZ/6vhP
AgAA

--=_e4b00c2a7b0774422f62ccb3551b0dbf
Content-Transfer-Encoding: base64
Content-Type: text/plain; charset="utf-8"

--=_e4b00c2a7b0774422f62ccb3551b0dbf
Content-Transfer-Encoding: base64
Content-Type: text/html; charset="utf-8"

--=_e4b00c2a7b0774422f62ccb3551b0dbf--

- 'new ticket alert' mail, when it sends a blank mail with a zero size image attachment "powered-by-osticket.png", (sensitive info masked as *****):

To: < * >
Subject: New Ticket Alert
X-PHP-Originating-Script: 48:mail.php
Content-Type: multipart/alternative;
boundary="=_0afc55870ea1eac705da45320b62d59c"
MIME-Version: 1.0
From: osTicket Alerts <alerts@
>
Date: Wed, 3 Sep 2014 11:02:57 +0200
Message-ID: <5ab1fd8fa-FbdNSfjrj-alerts@
***>
X-Mailer: osTicket Mailer
X-Auto-Response-Suppress: OOF, AutoReply
Auto-Submitted: auto-generated
In-Reply-To: dp3P41p3s39hVVAk.Bq.DedF@513a9cbf1a
References: dp3P41p3s39hVVAk.Bq.DedF@513a9cbf1a
Return-Path: apache@*****
X-OriginalArrivalTime: 03 Sep 2014 09:02:56.0985 (UTC) FILETIME=[DA8CEC90:01CFC755]
X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrNIsWRmVeSWpSXmKPExsUyM+Jvja7TTbYQg+cv1C3WXPrL6sDo0bJ3
L1sAYxSXTUpqTmZZapG+XQJXxo4Zh5kLLrNWHHov18A4hbWLkZNDQsBEYtL3VmYIW0ziwr31
bF2MXBxCAkcZJWYuncgC4WxnlHh49hYzhLOGUWJu8wKoTCOjROu/6WCzRARUJBoenmPvYuTg
EBaQlOi4yw0xVlVi/pYPbCA2s0CIxMWHp8HW8QoISpyc+YQFxGYDOuNL+09GEJsFaMzMK+uZ
IGrsJJovnYM6T1Li5pdzTBC2hsSq5f/B1jIKyEn8OPYYLM4pYCTx98YGdhBbSMBQ4unKHkYI
20ji/NY9LBC9wRLn5+1imcAoOgvJSbOQnAQRV5SY0v2QfRbQN8wCmhLrd+lDhAMkrj26yYqq
BMTWkGidM5cdU9xFYtWml4wQtrnEqfsLoXq9JNbfmsGygJF7FaNocWpxUm66kZFealFmcnFx
fp5eXmrJJkZg7B7c8ttgB+PL546HGAU4GJV4eBXK2EKEWBPLiitzDzFKc7AoifMuPDcvWEgg
PbEkNTs1tSC1KL6oNCe1+BAjEwenVANj21nv8onJDiy1ns2JInMfzDo/VTDpQequukcfzgS0
eBokvv+sVq+zeurFjM4Yw75lV3tu8vTwBZQtzv7uumhjbP3Vwo23DvuwTHi+JmxCpEtr947O
32ds2ncnX55WKydSYdiWbH671yLy1bFcJ67sRb9eKh7TOJd7hOvf9JtR6xxcvYLuyospsRRn
JBpqMRcVJwIAx+ZtfL4CAAA=

--=_0afc55870ea1eac705da45320b62d59c
Content-Transfer-Encoding: base64
Content-Type: text/plain; charset="utf-8"

--=_0afc55870ea1eac705da45320b62d59c
Content-Type: multipart/related;
boundary="=_1d68419ef904ca4666c565fc453f2a10"

--=_1d68419ef904ca4666c565fc453f2a10
Content-Transfer-Encoding: base64
Content-Type: text/html; charset="utf-8"

--=_1d68419ef904ca4666c565fc453f2a10
Content-Transfer-Encoding: base64
Content-ID: <b56944cb4722cc5cda9d1e23a3ea7fbc@*****>
Content-Type: image/png; name="powered-by-osticket.png"
Content-Disposition: inline; filename="powered-by-osticket.png"; size=5128

--=_1d68419ef904ca4666c565fc453f2a10--
--=_0afc55870ea1eac705da45320b62d59c-

The server is a Centos 6.4 with postfix-2.6.6.

The SMTP relay don't know what it is, but it throws this when connecting to it: "Microsoft ESMTP MAIL Service, Version: 7.5.7601.17514"

This is the installation information:

Server Information
osTicket Version v1.9.3 (bba9ccc)
Server Software Apache/2.2.15 (CentOS)
PHP Version 5.3.3
MySQL Version 5.1.69
PHP Extensions
gdlib Used for image manipulation and PDF printing
imap Used for email fetching
xml XML API
xml-dom Used for HTML email processing
json Improves performance creating and processing JSON
gettext Improves performance for non US-English configurations
mbstring Highly recommended for non western european language content
phar Highly recommended for plugins and language packs PHP Settings
cgi.fix_pathinfo = "1" is recommended if AJAX is not working
Database Usage
Database Space Used 0.27 MiB
Database Space for Attachments 0.02 MiB

Regards,
Fred

@fredastaire
Copy link
Author

Ok, I finally fixed it with the help of this forum post.

What I changed was line 170 in include/fileclass.mailer.php:

From this:
$mime = new Mail_mime();
To this:
$mime = new Mail_mime("\n");

So the if clause ended up like this:

   if ((extension_loaded('suhosin') || defined("SUHOSIN_PATCH"))
            && !$this->getSMTPInfo())
        $mime = new Mail_mime("\n");
    else
        // Use defaults
        $mime = new Mail_mime("\n");

I guess I could've gotten rid of the if altogether.

Does this change has any collateral damage? If not, why not using the "\n" in all cases by default?.

Regards,
Fred.

@greezybacon
Copy link
Contributor

The RFC for internet mail ("Email"), RFC 822 and it's successors, specify CRLF (\r\n) as the end of line terminator. Several libraries and mail filter systems misinterpret the mail and muck it up. Something between PHP and your mail client is dropping the bodies. Interestingly enough, I see there is a size=5128 parameter in the attachment header in your email. There is no body, but the non-zero size indicates that the mail library inside osTicket originally sent a body with 5128 bytes. Something thereafter dropped the body.

It seems that using the non-standard end of line terminator (\n) is a fair workaround. We've heard of many instances of this, but can't seem to identify 100% when to use the non-standard EOL

@fredastaire
Copy link
Author

Hi greezybacon,

As this happens to many people I guess a setting in the admin panel to set the "\n" on and off would be of great help.
Advantages of this new setting would be:

  • Reduce frustration. People go looking for a wrongly set option if something does not work as expected. Finding this setting would help to reduce frustration, especially on less technical people. Less questions over it in forums, github, etc..
  • User's wouldn't have to remember to make this change in the code everytime they upgrade the software.

Just my two cents.

Thank you for such a great tool BTW.

Regards,
Fred

@greezybacon
Copy link
Contributor

@fredastaire I would accept an addition to the config file like this

define('MAIL_EOL', "\n");

@fredastaire
Copy link
Author

@greezybacon
Whatever you guys think is the best way to do it. For me that was just an idea I thought would help. Unfortunately I'm just an user myself, not a developer.

Regards,
Fred

@greezybacon
Copy link
Contributor

@fredastaire can you maybe try the patch in #1248

@fredastaire
Copy link
Author

@greezybacon
Yeah, sure thing. If I just knew how to do it.. Excuse my inexperience, but I've never done this before. How do I apply the patch?, do I have to make the changes manually or is there some other way ?.

Regards,
Fred.

@greezybacon
Copy link
Contributor

The easiest way is to download from https://github.com/greezybacon/osTicket-1.8/archive/issue/mail-eol.zip and extract over your osTicket installation.

The next easiest way is to download the class.mailer.php file from https://github.com/greezybacon/osTicket-1.8/raw/d3bf49915ac3a5c56c40c75ed76bb6118590d314/include/class.mailer.php and add this to your ost-config.php file:

define("MAIL_EOL", "\n");

@fredastaire
Copy link
Author

@greezybacon
EDIT: THIS WAS FINALLY MY MISTAKE, PLS SEE MY NEXT MESSAGES
Ok, I just tried option 1 and now it prompts for a system upgrade, but doesn't let me do it due to this message:

The upgrader does NOT support upgrading from the current patch [03ff59bf35a58a102e9b32ad33c2839f]!

@fredastaire
Copy link
Author

Luckily enough I had made a backup. After restoration I followed step 2 and now the body is seen in the emails, so it worked!.

But, is this like a fixed setting or is it something we can switch on and off (I havent find any options for this in the admin panel)?.

Regards,
Fred.

@fredastaire
Copy link
Author

@greezybacon
Ooops, sorry, I messed up. Where I actually tried the patch was in a v1.9.4-rc1-5-gfdd82a7 install, maybe that's why step 1 didnt work.

I guess good news is that the patch really worked on that version, which had the same problem as 1.9.3.

I'm gonna try the patch over a real 1.9.3 and report.

@fredastaire
Copy link
Author

@greezybacon
Yep, It did work on 1.9.3 as well, good job!.

Regards,
Fred.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants