OJS OCS OMP OHS

You are viewing the PKP Support Forum | PKP Home Wiki



Email Attachments?

Are you responsible for making OCS work -- installing, upgrading, migrating or troubleshooting? Do you think you've found a bug? Post in this forum.

Moderators: jmacgreg, michael, John

Forum rules
What to do if you have a technical problem with OCS:

1. Search the forum. You can do this from the Advanced Search Page or from our Google Custom Search, which will search the entire PKP site. If you are encountering an error, we especially recommend searching the forum for said error.

2. Check the FAQ to see if your question or error has already been resolved. Please note that this FAQ is OJS-centric, but most issues are applicable to both platforms.

3. Post a question, but please, only after trying the above two solutions. If it's a workflow or usability question you should probably post to the OCS Conference Support and Discussion subforum; if you have a development question, try the OCS Development subforum.

Email Attachments?

Postby tshore » Tue Jul 23, 2013 1:39 pm

Trying to send an email using:

Conference Manager >> All Enrolled Users

Attachments aren't coming through properly. Tried a PDF and JPG.

Did a test from another 2.3.5 conference site that sits on the same server (VPS) and it worked fine.

Using OCS 2.3.5 (copied from the site that I tested the email with) with recommended patches applied.
tshore
 
Posts: 264
Joined: Fri Nov 18, 2005 12:48 pm
Location: Hamilton, Ontario

Re: Email Attachments?

Postby asmecher » Tue Jul 23, 2013 2:14 pm

Hi Trudy,

Do the uploads "stick" (when you click Upload, does the subsequent page show their details)?

If you send the two emails to your account and compare the email source ("View Source" in most email clients) do they look the same, or is there any information on e.g. spam filtering that differs?

Are both OCS installs configured the same way for mail sending (see config.inc.php e.g. for SMTP configuration)?

Regards,
Alec Smecher
Public Knowledge Project Team
asmecher
 
Posts: 8316
Joined: Wed Aug 10, 2005 12:56 pm

Re: Email Attachments?

Postby tshore » Thu Jul 25, 2013 8:48 am

Yes, the upload seems to work properly.

Ok, there's more to this...

First of all, I was mistaken. It's also not working from my other conference site. It only worked if I sent it to an account hosted on the same server.

If I look at the email on gmail.com, the attachment is fine, but in my inbox on my Mac, it's no good. Sending to a few other accounts I get the same problem, so it's not just a gmail issue.

Neither installation of OCS is using SMTP.

Here is the raw source for an email where the attachment is fine:
Code: Select all
X-Antivirus: avast! (VPS 13072400)
X-Antivirus-Status: Clean
Return-path: <csbbcs@vps3.mohsho.com>
Envelope-to: webmaster@csbbcs.org
Delivery-date: Wed, 24 Jul 2013 16:05:14 -0400
Received: from csbbcs by vps3.mohsho.com with local (Exim 4.80.1)
   (envelope-from <csbbcs@vps3.mohsho.com>)
   id 1V25JB-0007hL-GE; Wed, 24 Jul 2013 16:05:13 -0400
To: tshore@mohsho.com
Subject: [CSBBCS 2013] tesst2
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="==boundary_0637e5b9301d04fddccc077f00444304"
X-Mailer: Public Knowledge Project Suite v2
X-Originating-IP: 24.141.110.158
Date: Wed, 24 Jul 2013 16:05:13 -0400
From: "admin" <webmaster@csbbcs.org>
Message-Id: <E1V25JB-0007hL-GE@vps3.mohsho.com>


--==boundary_0637e5b9301d04fddccc077f00444304
Content-Transfer-Encoding: 8bit
Content-Type: text/plain;
   charset=utf-8

test
________________________________________________________________________

CSBBCS 2013
University of Calgary
Calgary, AB
June 7-9, 2013
http://www.csbbcs.org/2013/

--==boundary_0637e5b9301d04fddccc077f00444304
Content-Disposition: attachment
Content-Type: error:cannotopen`/tmp;
   name=ICPM4_call.pdf
Content-Transfer-Encoding: base64

JVBERi0xLjMKJcTl8uXrp/Og0MTGCjQgMCBvYmoKPDwgL0xlbmd0aCA1IDAgUiAvRmlsdGVyIC9G

And here's the source of one that didn't work:
Code: Select all
Return-path: <csbbcs@vps3.mohsho.com>
Received: from st11p00mm-smtpin001.mac.com ([17.172.83.250])
 by ms01562.mac.com (Oracle Communications Messaging Server 7u4-27.07
 (7.0.4.27.6) 64bit (built Jun 21 2013))
 with ESMTP id <0MQH00J2AZ88X9F0@ms01562.mac.com> for dishore@me.com; Thu,
 25 Jul 2013 15:04:57 +0000 (GMT)
Original-recipient: rfc822;dishore@me.com
Received: from vps3.mohsho.com ([72.15.54.234]) by st11p00mm-smtpin001.mac.com
 (Oracle Communications Messaging Server 7u4-27.07(7.0.4.27.6) 64bit (built Jun
 21 2013)) with ESMTP id <0MQH00MSDZ7TK8F0@st11p00mm-smtpin001.mac.com> for
 dishore@me.com (ORCPT dishore@me.com); Thu, 25 Jul 2013 15:04:56 +0000 (GMT)
Received-SPF: none (st11p00mm-spfmilter002.mac.com: csbbcs@vps3.mohsho.com does
 not designate permitted sender hosts) receiver=st11p00mm-spfmilter002.mac.com;
 client-ip=72.15.54.234; helo=vps3.mohsho.com;
 envelope-from=csbbcs@vps3.mohsho.com; x-software=spfmilter 0.97
 http://www.acme.com/software/spfmilter/ with libspf-unknown;
Received: from csbbcs by vps3.mohsho.com with local (Exim 4.80.1)
   (envelope-from <csbbcs@vps3.mohsho.com>)   id 1V2N5s-0007si-9R; Thu,
 25 Jul 2013 11:04:40 -0400
To: dishore@me.com
Subject: [CSBBCS 2013] Another Test, Sorry!
MIME-version: 1.0
Content-type: multipart/mixed;
 boundary="==boundary_389f510a4b6e2112d9998353fbcc3721"
X-Mailer: Public Knowledge Project Suite v2
X-Originating-IP: 24.141.110.158
Date: Thu, 25 Jul 2013 11:04:40 -0400
From: admin <webmaster@csbbcs.org>
Cc: dshore@mcmaster.ca
Message-id: <E1V2N5s-0007si-9R@vps3.mohsho.com>
Authentication-results: st11p00mm-smtpin001.mac.com; dkim=none
   reason="no signature"; dkim-adsp=none
x-icloud-spam-score: 30022
 f=csbbcs.org;e=vps3.mohsho.com;pp=ham;spf=?;dkim=?;wl=absent;pwl=absent
X-Proofpoint-Virus-Version: vendor=fsecure
 engine=2.50.10432:5.10.8794,1.0.431,0.0.0000
 definitions=2013-07-25_06:2013-07-25,2013-07-25,1970-01-01 signatures=0
X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0
 suspectscore=1 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0
 reason=mlx scancount=1 engine=7.0.1-1305240000 definitions=main-1307250073
X-AntiAbuse: This header was added to track abuse,
 please include it with any abuse report
X-AntiAbuse: Primary Hostname - vps3.mohsho.com
X-AntiAbuse: Original Domain - me.com
X-AntiAbuse: Originator/Caller UID/GID - [502 501] / [47 12]
X-AntiAbuse: Sender Address Domain - vps3.mohsho.com
X-Get-Message-Sender-Via: vps3.mohsho.com: authenticated_id: csbbcs/from_h


--==boundary_389f510a4b6e2112d9998353fbcc3721
Content-Transfer-Encoding: 7BIT
Content-Type: TEXT/PLAIN;
   charset=utf-8

You can just ignore this.  I'm going to check it on your email myself.
________________________________________________________________________

CSBBCS 2013
University of Calgary
Calgary, AB
June 7-9, 2013
http://www.csbbcs.org/2013/

--==boundary_389f510a4b6e2112d9998353fbcc3721
Content-Transfer-Encoding: BASE64
Content-Type: TEXT/PLAIN;
   charset=us-ascii

JVBERi0xLjMKJcTl8uXrp/Og0MTGCjQgMCBvYmoKPDwgL0xlbmd0aCA1IDAgUiAvRmlsdGVyIC9G

Any suggestions you might have would be very much appreciated. My client wanted to send out an email - with an attachment - to all enrolled users and she wanted to do it last week...
tshore
 
Posts: 264
Joined: Fri Nov 18, 2005 12:48 pm
Location: Hamilton, Ontario

Re: Email Attachments?

Postby asmecher » Thu Jul 25, 2013 9:36 am

Hi Trudy,

The email is definitely getting munged in delivery, though I can't confirm at this point whether that's the cause of the problem. I'd suggest trying an SMTP configuration (even temporarily, e.g. using your gmail credentials) to see if that improves the situation. If that gets attachments through e.g. to gmail, then your mail delivery setup is the problem. Unfortunately that's generally pretty opaque to hosting accounts and doesn't depend solely on your host.

Regards,
Alec Smecher
Public Knowledge Project Team
asmecher
 
Posts: 8316
Joined: Wed Aug 10, 2005 12:56 pm

Re: Email Attachments?

Postby tshore » Tue Aug 13, 2013 11:13 am

I still can't track this down. I couldn't get the SMTP setup to work and I'm a bit paranoid to having my SMTP credentials sitting there in and unencrypted file.

Did you try sending out an attachment from your OCS installation?
tshore
 
Posts: 264
Joined: Fri Nov 18, 2005 12:48 pm
Location: Hamilton, Ontario

Re: Email Attachments?

Postby asmecher » Tue Aug 13, 2013 11:54 am

Hi Trudy,

There's a description for how to set up e.g. gmail at http://pkp.sfu.ca/wiki/index.php/Using_gmail_SMTP. This would only need to be a temporary test.

I wasn't able to duplicate the problem locally.

Regards,
Alec Smecher
Public Knowledge Project Team
asmecher
 
Posts: 8316
Joined: Wed Aug 10, 2005 12:56 pm

Re: Email Attachments?

Postby tshore » Wed Aug 14, 2013 1:27 pm

I cannot, for the life of me, get SMTP mailing to work. I tried Gmail, using the link in your last post and I tried my own SMTP server and tried many different combinations of settings in config.inc.php. Mostly following suggestions from a myriad of forum posts on the topic. After I figured out that I had to recompile Apache with OpenSSL, I was always getting OJS SMTPMailer: Could not authenticate and then in a few cases with my mailserver, I got this one: OJS SMTPMailer: Did not receive expected 250 or 251. I think that was happening when I tried to use SSL with my mailserver.

So I'm back to trying to figure out why attachments aren't getting through properly using PHP mail. All I want to do is send out the call for papers email to all users in the DB and attach a PDF to the message.
tshore
 
Posts: 264
Joined: Fri Nov 18, 2005 12:48 pm
Location: Hamilton, Ontario

Re: Email Attachments?

Postby asmecher » Wed Aug 14, 2013 6:48 pm

Hi Trudy,

As an alternative: try submitting both messages to http://www.mimevalidator.net/ to see what it reports.

Note that a failure in one or both doesn't necessarily give us a clear culprit -- remember that both of these messages will have been passed through several mail servers before you'll have received them, and any of those can result in modifications to the message.

Regards,
Alec Smecher
Public Knowledge Project Team
asmecher
 
Posts: 8316
Joined: Wed Aug 10, 2005 12:56 pm

Re: Email Attachments?

Postby tshore » Thu Aug 15, 2013 12:12 am

MIMEValidator said the message that worked had errors and the message with the messed up attachment was fine.

Did an experiment and sent the same attachment in an email from webmail for the same domain (RoundCube). Attachment came through fine. I will show you below the differences between the raw source of 3 different messages. In each case I've just included the part right above the 3000+ lines of the attachment.

1. Sent from RoundCube to my Gmail account. Attachment is fine:
Code: Select all
--=_95809d0574e7efc0ee4aa61bacae411c
Content-Transfer-Encoding: base64
Content-Type: application/pdf;
 name=ICPM4_call.pdf
Content-Disposition: attachment;
 filename=ICPM4_call.pdf;
 size=205085

JVBERi0xLjMKJcTl8uXrp/Og0MTGCjQgMCBvYmoKPDwgL0xlbmd0aCA1IDAgUiAvRmlsdGVyIC9G...

2. Sent through OCS to a domain on the same server. Attachment is fine:
Code: Select all
--==boundary_d877c728ef3867eecb57356b3e0a2927
Content-Disposition: attachment
Content-Type: error:cannotopen`/tmp;
   name=ICPM4_call.pdf
Content-Transfer-Encoding: base64

JVBERi0xLjMKJcTl8uXrp/Og0MTGCjQgMCBvYmoKPDwgL0xlbmd0aCA1IDAgUiAvRmlsdGVyIC9G...

3. Sent through OCS to my Gmail account. Attachment is fine checking Gmail through browser, but comes through as "Mail Attachment.txt" in OSX Mail:
Code: Select all
--==boundary_7cfa64bd71304c40c9fa68364494f395
Content-Disposition: ATTACHMENT
Content-Type: TEXT/PLAIN
Content-Transfer-Encoding: BASE64

JVBERi0xLjMKJcTl8uXrp/Og0MTGCjQgMCBvYmoKPDwgL0xlbmd0aCA1IDAgUiAvRmlsdGVyIC9G

So could there be an issue with Content-Type and does the error with /tmp indicate that there's a problem?
tshore
 
Posts: 264
Joined: Fri Nov 18, 2005 12:48 pm
Location: Hamilton, Ontario

Re: Email Attachments?

Postby asmecher » Thu Aug 15, 2013 8:50 am

Hi Trudy,

The Content-Type header is determined using String::mime_content_type. The call can be seen in lib/pkp/classes/mail/Mail.inc.php around line 197:
Code: Select all
                if (empty($contentType)) {
                        $contentType = String::mime_content_type($filePath);
                        if (empty($contentType)) $contentType = 'application/x-unknown-content-type';
                }
...and the code for determining content types can be found in lib/pkp/classes/core/String.inc.php around line 372.

There are lots of threads about how this function works because it'll depend heavily on your PHP configuration, but basically there are three separate techniques used to try to find the MIME type: mime_content_type (deprecated, not available in new PHPs), finfo_open and other file info functions (not available in all PHPs), and finally the system's "file" command-line utility.

I'd suggest investigating to see which approach is being used in your case, and whether it's returning a valid MIME type.

Regards,
Alec Smecher
Public Knowledge Project Team
asmecher
 
Posts: 8316
Joined: Wed Aug 10, 2005 12:56 pm

Re: Email Attachments?

Postby tshore » Thu Aug 15, 2013 11:47 pm

OMG that almost killed me. This is what I had to do in order for the MIME type to be set correctly for email attachments.

In lib/pkp/classes/file/PKPTemporaryFileManager.inc.php, I had to replace line 138:

$temporaryFile->setFileType($this->getUploadedFileType($fileName));

with this:

$temporaryFile->setFileType($_FILES[$fileName]['type']);

So the filetype was already set correctly, but then in line 138 it went away and encountered an error and the filetype was set to something like:

ERROR: cannot open `/tmp/phpXBULeA' (No such file or directory)

I'm thinking that there must be a reason that it tries again to get the filetype, but I can't devote anymore time to this right now.
tshore
 
Posts: 264
Joined: Fri Nov 18, 2005 12:48 pm
Location: Hamilton, Ontario

Re: Email Attachments?

Postby asmecher » Fri Aug 16, 2013 10:44 am

Hi Trudy,

Got it -- your installation is using the external "file" tool because it supports neither mime_content_type nor file_info; when that is called on a missing file it returns the "Error: cannot open..." message you were seeing in your email headers. OCS was taking that value as though it were a valid MIME type. The other MIME type detection approaches fell back appropriately on the browser-supplied value, which we generally prefer not to trust. I've posted a fix at http://pkp.sfu.ca/wiki/index.php?title=OCS_2.3.5_Recommended_Patches under bug #8400.

Regards,
Alec Smecher
Public Knowledge Project Team
asmecher
 
Posts: 8316
Joined: Wed Aug 10, 2005 12:56 pm

Re: Email Attachments?

Postby tshore » Fri Aug 16, 2013 11:59 am

I assume that mime_content_type isn't working because it's deprecated, but what about file_info? What do I need to do to get it working?

I also prefer not to trust the browser supplied value, assuming that it's a security issue.

Here's a link to a copy of my phpinfo():

http://www.prospectivememory.org/2014/phpinfo.html
tshore
 
Posts: 264
Joined: Fri Nov 18, 2005 12:48 pm
Location: Hamilton, Ontario

Re: Email Attachments?

Postby tshore » Thu Oct 03, 2013 10:45 am

I could see this in phpinfo: '--disable-fileinfo', so I knew that I had to enable fileinfo. It's not as easy as other PHP options.

So in order to enable fileinfo in PHP, I had reconfigure Apache. I use WHM for my server, so here are the instructions if you also have WHM:

http://www.opensource-excellence.com/blog/item/464-how-to-install-fileinfo-in-whm.html

My attachments now come through fine. I think maybe there could be a more graceful (or informative) way to handle this instead of just sending out corrupt attachments? Especially since it looks like fileinfo may be disabled by default when you setup a new server with PHP.
tshore
 
Posts: 264
Joined: Fri Nov 18, 2005 12:48 pm
Location: Hamilton, Ontario

Re: Email Attachments?

Postby asmecher » Thu Oct 03, 2013 11:18 am

Hi tshore,

Bug #8400 referenced above should resolve the attachment corruption issue.

Regards,
Alec Smecher
Public Knowledge Project Team
asmecher
 
Posts: 8316
Joined: Wed Aug 10, 2005 12:56 pm


Return to OCS Technical Support

Who is online

Users browsing this forum: Google [Bot] and 1 guest