Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8552601
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T14:27:33+00:00 2026-06-11T14:27:33+00:00

I habe some trouble with Zend Framework and fetching Attachements from GMAIL. Authentication is

  • 0

I habe some trouble with Zend Framework and fetching Attachements from GMAIL. Authentication is handeld by oAuth.

It is no problem to fetch the Mailtext, but i cant fetch the attachement, or better i have no idea how to do it (;

        if ($message->isMultiPart()) {

            $iParts = $message->countParts();

            for ($i = 1; $i < $iParts; $i++) {
                $part = $message->getPart($i);

                // ATTACHEMENT?
                if () {
                    // DO MAIL DOWNLOAD
                }

                // MAIL TEXT
                if (strtok($part->contentType, ';') == 'text/plain') {
                    $encoding = $part->getHeader('content-transfer-encoding');
                    $contentType = $part->getHeader('content-type');
                    $content = $part->getContent();
                    break;
                } 
            }

Header from my mail (removed some details):

[delivered-to] => xxxx@gmail.com
[received] => Array
    (
        [0] => 
        [1] => 
        [2] => 
        [3] => 
    )
[return-path] => 
[received-spf] => 
[authentication-results] => 
[dkim-signature] =>
[mime-version] => 1.0
[from] => 
[date] => Thu, 30 Aug 2012 17:16:37 +0200
[message-id] => 
[subject] => ANHANG
[to] => 
[content-type] => multipart/mixed; boundary=f46d043bd88a9f5d9404c87d2ad5
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T14:27:34+00:00Added an answer on June 11, 2026 at 2:27 pm

    I haven’t tried it but, if it works, you owe me a beer… Anyways, Try this: Logically it should work…

    if ($message->isMultiPart()) {
         $part = $message->getPart(2);
    }
    
           // Remember mails with attachment are MULTI-part? (:
           $filename = $part->getHeader('content-description');
           $attachment = base64_decode($part->getContent()); //we decode because mails are encoded with base 64
    
           // File operations
           $fh = fopen($filename, 'w');
           fwrite($fh, $attachment);
           fclose($fh);
    

    If u get error, post it here

    or if it works, gimme a tick 😉

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I habe a main table that i select from and a table with subelements
I habe a problem with my latest Liferay Portlet or rather a JSP I'm
We habe to use an old Dojo Version 1.1.x, our problem is to find
I habe a rendering Problem with Slickgrid in IE9. (As allways all other browsers
my application geting Text from a input field an post it over ajax to
hey im writing a c# flv2mp3 converter and i could need some help. flv
My aim is to habe a listing of all wave files in a specific
i habe many entries in excell ( more than 3000 ). actually their are
I habe a few million objects hanging around in memory. I want to find
I habe read here about defining method for a Javascript class Advantages of using

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.