• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Can't Add Multiple Email Attachments

#1
[eluser]david_ais[/eluser]
I'm attempting to generate an email with two attachments.

According to the documentation that can be accomplished by using the attach function multiple times like this:

Code:
$this->email->attach('/path/to/file1.pdf');
$this->email->attach('/path/to/file1.pdf');

But I've found that only the first instance of the function generates an attachment. The second attach function is ignored.

Am I missing something? Has the syntax changed - or is this a bug? Either way can anyone suggest a workaround?

Regards

David

#2
[eluser]david_ais[/eluser]
I've found an explanation to what was happening but so far not a solution.

In this scenario, both attachments are PDF files. My email client is Microsoft Entourage

It turns out that the attachments are there. But when the email goes to an IMAP account, only one attachment is visible with the name of the first one that was attached. But the two attachments are merged in some way. When I try to open it, Acrobat reports that the file is corrupted.

If the email is sent to a POP3 mailbox attachments work as normal.

If I download the email from the IMAP server to my local client, both attachments appear and can be opened normally - both locally and from that point on, are accessible in the IMAP server - even though they we're before!

I've tried this with two different IMAP accounts on different server platforms with different ISPs, and also have generated the emails both from CI scripts and manually, and with different PDF files. So that seems to eliminate issues with the mail servers, with the PDF files, with the client sending the email and with the CI script. I'm not sure what's left!!

Although the attachments are eventually accessible, I still need to try and resolve this to avoid the problem completely. The attachments accompany an order confirmation generated by my CI based shopping cart system. So it's essential that the attachments are fully accessible.

I know this doesn't look like a CI problem now. But has anyone got any ideas on how to sort this out? Plan B is to send two different emails. That'll work but it's using more resources than it needs to and ideally both attachments need to accompany the order confirmation email.


Regards


David

#3
[eluser]david_ais[/eluser]
I think I'm getting too old for this.

The answer has finally become obvious - it's the IMAP account that's doing it. Everything has been working OK all along.

Email plus attachments is only partially downloaded initially. So the attachments can't be opened and the attachment list appears incomplete and inaccessible till the whole message has been downloaded.

Sorry for the un-necessary post!!!


Regards

David


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2019 MyBB Group.