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

  • Home
  • SEARCH
  • 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 8950319
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T13:25:39+00:00 2026-06-15T13:25:39+00:00

I am developing an app for my work (social housing) and I want it

  • 0

I am developing an app for my work (social housing) and I want it to be able to allow the user to take a photo and attach it to an email so they can send it to us (pictures of repairs etc)

I’m using Phonegap and Eclipse as I want the app to be cross platform but am testing in Android primarily at the moment. Is there a way to do this? I am currently using the code below with no avail.

      <script typr="text/javascript" charset="utf-8">

    function camera()
    {
        navigator.camera.getPicture(onSuccess, onFail, { quality: 20,
            destinationType: Camera.DestinationType.DATA_URL
         }); 

        function onSuccess(imageData) {
            var image = document.getElementById('image');
            var data = "data:image/jpeg;base64," + imageData;

            var link = "mailto:johnsmith@gmail.com?body="+data+"&subject=john smith";

            window.location.href = link;
        }

        function onFail(message) {
            alert('Failed because: ' + message);
        }

    }
    </script>

So far I’ve tried passing the data through to the mail app using the mailto: &attachment method but that never attaches an image (most mail apps treat this as a security hole). Then I tried to embed the base64 code of the image in the body of the email (as shown above). Unfortunately the base64 just displays as plain text and makes mail unresponsive. I’ve also tried using the image URI instead of the Base64 method in Phonegap but that throws an ‘image.URI is not defined’ error in my logcat.

Is this possible? I know I can use intents for just android as detailed in another question here but this won’t work on iOS etc.

Any help would be greatly appreciated.

EDIT 02/12/2012

What I’m trying to achieve here is the same functionality you get in the native Android gallery/camera app. After you take a picture you have share options, one of which is mail. If you chose to share via mail the image is passed to the mail app as an attachment. Is there any way I can implement this same functionality in my app?

  • 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-15T13:25:40+00:00Added an answer on June 15, 2026 at 1:25 pm

    So it looks like there is no ‘one size fits all’ solution for this problem.

    The mailto: method just doesn’t pass attachments in most modern mail apps as it’s seen as a security risk. So regardless of whether its an imageURI or a base64 encoded image, mailto: just won’t work. The passing of ‘subject’ and ‘body’ works well though for anyone that wants to use the above code for pre-filling in an email with no attachments.

    After posing this question elsewhere it looks like I’ll need to use a phonegap plugin (emailComposer for iOS and WebIntent for Android) in order to pass an image sucessfully to a mail app from my phonegap app.

    Thanks.

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

Sidebar

Related Questions

I'm developing web app that user can save his/her work to server. The data
I am developing an app in which I have to allow user to edit
I'm developing an app locally (under Domain name <mydomain>.dev ). In order to work
im developing an app for the iphone and im able to get a video
I am developing facebook app in which i am fetching user's friend detail in
I am developing an app in python with pyGtk+Glade. I want to execute a
i am developing a app which contains feature like default photo browser in iphone.
I'm developing a camera app basically as part of a messaging app to attach
I am developing an app which supposed to work on devices that have OS
I'm developing an app using phonegap/cordova (1.7.0), I can't figure out how to make

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.