Comments (10)
I am also not getting the attachment.. it show an icon of a "pdf" in the window it opens. this is what i am doing.., it does send the email without an attachment fine.
var canvas = document.getElementById('myCanvas')
var imageData = canvas.toDataURL()
console.log(imageData);
window.plugin.email.open({
to: ['[email protected]'],
attachments: [imageData],
subject: 'SnapShot',
body: 'How are you? Nice greetings from Leipzig'
});
from cordova-plugin-email-composer.
Hello
Is there any one who can help me on this. ? i tried to add html in the body with
' where img is a base64 string. it showing me good on the email composer in Ipad but at receiving end nothing is there.??
from cordova-plugin-email-composer.
The pdf icon in the mail composer doesn't mean, that the attachment is actually working! iOS seems to add an empty attachment as long as there is a file name with an extension it knows. If you are using an image or a pdf there should be an actual preview of it if it's working.
from cordova-plugin-email-composer.
Hello
Any answer of my question i am adding simple html in the body and set the html attribute to true also. it showing me that attachment fine in the iPad but at the receiving end its not showing anything event not that html.
note:- using Google account in the iPad for sending the email.
Thanks
Avneet
from cordova-plugin-email-composer.
... I am busy at the moment :(
from cordova-plugin-email-composer.
I've been trying to get it to work on Android and it appears to be a problem with the storage path. I've replaced a couple of lines in EmailComposer.java with a path that works on my test phone and verified that it does work but this is not a final solution since I'm creating the folder manually and I'm not sure this will work on other phones. This is my first try at modifying an Cordova plugin so I will keep working on it and if I come up with a good solution I will post it. I'm going to look at the iOS side also.
} else if (path.startsWith("base64:")) {
String resName = path.substring(path.indexOf(":") + 1, path.indexOf("//"));
String resData = path.substring(path.indexOf("//") +2);
byte[] bytes = Base64.decode(resData, 0);
//String storage = this.cordova.getActivity().getCacheDir() + "/email_composer";
String storage = "/storage/sdcard0/Android/data/de.appplant.cordova.plugin/email_composer";
File file = new File(storage, resName);
new File(storage).mkdir();
try {
FileOutputStream os = new FileOutputStream(file, true);
os.write(bytes);
os.flush();
os.close();
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
//return Uri.parse("content://" + AttachmentProvider.AUTHORITY + "/" + resName);
return Uri.parse("file://" + storage + "/" + resName);
}
from cordova-plugin-email-composer.
Let me be a little more specific. The code
this.cordova.getActivity().getCacheDir() + "/email_composer"
returns the following for my app (PolicyHolderServices)
/data/data/com.fmins.policyholderservices/cache/email_composer
and
"content://" + AttachmentProvider.AUTHORITY
returns
content://de.appplant.cordova.plugin.emailcomposer.attachmentprovider
So there seems to be a mismatch between the path being used to create the temporary file for the attachment and the path being used to retrieve it.
from cordova-plugin-email-composer.
Here's what I'm going with for Android. It requires external storage but so do some of the other options in the email composer. I borrowed a little bit from the relative section and also from the following SO article. Now onto iOS.
} else if (path.startsWith("base64:")) {
String resName = path.substring(path.indexOf(":") + 1, path.indexOf("//"));
String resData = path.substring(path.indexOf("//") +2);
byte[] bytes = Base64.decode(resData, 0);
File imageDir = new File(
Environment.getExternalStorageDirectory(),
"/Android/data/" + this.cordova.getActivity().getPackageName() + "/email_composer");
if (!imageDir.exists()) {
imageDir.mkdirs();
}
File file = new File(imageDir, resName);
try {
FileOutputStream os = new FileOutputStream(file, true);
os.write(bytes);
os.flush();
os.close();
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
return Uri.fromFile(file);
}
from cordova-plugin-email-composer.
Hello
any update regarding sending the html data in body ??
from cordova-plugin-email-composer.
Hello,
both relative:// and base64:// had an error, which have been fixed now (missing permission and wrong dir path).
from cordova-plugin-email-composer.
Related Issues (20)
- How to attach files in iOS? HOT 1
- 'Cordova/CDVAvailability.h' file not found HOT 1
- How to handle email sent or not ? HOT 1
- Application crush after try to open client HOT 27
- cordova-plugin-email-composer does not work on iOS 13+ HOT 26
- Email Composer not working for IOS 13+ HOT 5
- Failed to build in ionic project HOT 5
- On Android 11, emailComposer.open() do nothing nor call error HOT 9
- Calling .open() crushes the app with targetSdk set to 30 on Android HOT 17
- Attachments problem in Outlook HOT 7
- Closing the dialog by clicking outside of it does not complete the promise (iOS) HOT 1
- Crash on Samsung Galaxy A12 / Android 11 HOT 4
- Queries are not added to AndroidManifest.xml HOT 18
- package androidx.core.content does not exist Android HOT 5
- able to Open only mail in ios HOT 3
- EmailComposer.getPlugin.getClients is not a function
- Runtime exception HOT 3
- App getting crash as getEmailClientIds() return zero HOT 5
- Email blocked in outbox on mail app (iPhone) HOT 1
- java.lang.RuntimeException: Unable to start activity ComponentInfo{...}, Failed to create webview. HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cordova-plugin-email-composer.