|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #26742 The base64_encode() function returns an string that cannot decoded by outlook
Submitted: 2003-12-29 09:32 UTC Modified: 2004-01-06 20:51 UTC
Avg. Score:4.5 ± 0.5
Reproduced:4 of 4 (100.0%)
Same Version:1 (25.0%)
Same OS:0 (0.0%)
From: eric dot maman at free dot fr Assigned:
Status: No Feedback Package: *URL Functions
PHP Version: 4.3.4 OS: Windows 2000
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Bug Type:
From: eric dot maman at free dot fr
New email:
PHP Version: OS:


 [2003-12-29 09:32 UTC] eric dot maman at free dot fr
I am using the base64_encode() function to send attachements by email.
When I receive the mail on Outlook, the attachement is visible but corrupeted.
I have tested the whole process and my conclusion is that the base64_encode() function does not work correctly.
I have made a workarround with an extrenal program that performs the base64 encoding and it work correctly.

Reproduce code:
    function EncodeString ($str, $encoding = "base64") {
        $encoded = "";
        switch(strtolower($encoding)) {
          case "base64":
              $encoded = chunk_split(base64_encode($str), 76, $this->LE);
          case "7bit":
          case "8bit":
              $encoded = $this->FixEOL($str);
              if (substr($encoded, -(strlen($this->LE))) != $this->LE)
                $encoded .= $this->LE;
          case "binary":
              $encoded = $str;
          case "quoted-printable":
              $encoded = $this->EncodeQP($str);
              $this->SetError($this->Lang("encoding") . $encoding);
        return $encoded;


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2003-12-29 10:35 UTC]
What is the value of $this->LE ? 
 [2004-01-06 20:51 UTC]
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Open". Thank you.

 [2004-01-22 14:48 UTC] luis dot cervantes at uspeurope dot com
I have the same problem with function. 
Can you tell me how you resolved the problem.
Its is possible that the problem is the instalation of php.
mimetypes, etc.
Thanks for all.

 [2004-03-10 08:49 UTC] louloufox29 at hotmail dot com
I have the same problem (using PHP 4.3.3 with Easy PHP on a win XP server)

When i send the attachment using Outlook, the part of message source about attachement is different. The string is not the same... (that's why it seems sorrupted). 

I've try to encode a file and then decode the same file, save it using a different name and  can't open it, it is the same probleme.
So i think it's realy a PHP Bogus (i can't believe in the config way of resolution...)

Regards !
 [2004-03-10 08:53 UTC] louloufox29 at hotmail dot com
Just for information, the problem exist with or without using the function send by eric. In my case, it wasn't a workaround.
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Apr 14 15:01:29 2024 UTC