GithubHelp home page GithubHelp logo

Comments (7)

jfoclpf avatar jfoclpf commented on August 11, 2024

Sending files directly from the file system is a bit buggy with Outlook, have you tried converting the files to base64 and attach them as base64? With me always works.

from cordova-plugin-email-composer.

aaale83 avatar aaale83 commented on August 11, 2024

Good suggestion thanks! i've just changed code in the app, i'm giving a feedback in the next couple of days.

from cordova-plugin-email-composer.

aaale83 avatar aaale83 commented on August 11, 2024

Problem seems to persist.

Yesterday stats were:

Total technicians using my app: 10
Total emails sent: 28
Total attachments sent: 41
Total missing attachments: 1

Here is a code example, am i doing something wrong?

Open file function to base 64:

function openFileToBase64(fileName) {

    return new Promise(resolve => {

        window.resolveLocalFileSystemURL(cordova.file.applicationStorageDirectory + 'files/', function(dirEntry) {

            dirEntry.getFile(fileName, { create: false }, function(fileEntry) {

                fileEntry.file(function (file) {
    
                    var reader = new FileReader();

                    reader.readAsDataURL(file);

                    reader.onloadend = function() {

                        resolve(this.result);    
                    };
    
                }, function (err) { console.error('error getting fileentry file!' + err); });

            });

        });

    });

}

Send email function:

async sendEmail() {

    var filenames = ["28384_rapportino.pdf", "28383_rapportino.pdf"];
    var files = [];
    var base64file = '';
    
    for (var x=0; x<filenames.length; x++) {
    
        base64file = await openFileToBase64(filenames[x]);
        base64file = base64file.split(",");
        files.push("base64:" + filenames[x] + "//" + base64file[1]);
    
    }
    
    var email_ref_client = "[email protected]";
    var email_cc = "[email protected]";
    var subject = "Test";
    var body = "PDF reports";
    var email_client = "outlook";
    
    cordova.plugins.email.open({
        to: email_ref_client,
        cc: email_cc,
        subject: subject,
        body:  body,
        app: email_client,
        attachments: files,
    }, function() {
        window.location.href = 'main.html';
    });

}

A couple of questions:

  1. Is there a way i can deeply debug the problem and somehow help?
  2. Is switching to Gmail app on all tablets and configure them to use office365 Exchange server a definitive solution to solve the problem?

from cordova-plugin-email-composer.

jfoclpf avatar jfoclpf commented on August 11, 2024

On a first glance you seem to do everything OK, this is what I use to convert images to base64 because in iOS the filesystem is also tricky. But your problem seems to reside in the fact that some files are not attached, which seems to be a different problem thus.

Yes, I would strongly suggest you to use Gmail instead, I'm using Gmail in Android for ages with this plugin and never had any issues. In Xiaomi devices you just have to activate MUI optimization to attach files.

If you want to deeply debug this plugin, we would deeply appreciate your PR. Check this file here, and this dir. You would need to know Java.

from cordova-plugin-email-composer.

jfoclpf avatar jfoclpf commented on August 11, 2024

Try also to search in the list of forks if everyone have already solved that issue
https://github.com/katzer/cordova-plugin-email-composer/network/members
If you find anything relevant, please do kindly share you results

from cordova-plugin-email-composer.

aaale83 avatar aaale83 commented on August 11, 2024

Is there a minimum Android version requirement? Could Android 7 be a problem despite using Gmail App ?

from cordova-plugin-email-composer.

jfoclpf avatar jfoclpf commented on August 11, 2024

Is there a minimum Android version requirement? Could Android 7 be a problem despite using Gmail App ?

I'm not aware of any. I am using this in Android 9, 10 and 11 it and works as expected.

The only restriction I've been seeing (Android 9, 10 and 11 + Gmail) is with Xiaomi devices wherein you have to activate MIUI optimization.

But yes, Android 7 is already quite old. Test it at least with 9.

from cordova-plugin-email-composer.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.