Open sroy93 opened 5 years ago
Can you show the actual code?
Sure. Here's the piece of it that contains the email portion: (See below the code for the value of the attachment path variable)
email.available().then((avail: boolean) => {
if(avail) {
dialogs.prompt({
title: "Enter Email",
message: "Please enter the address you want to send the document to below",
okButtonText: "Send",
cancelButtonText: "Cancel",
inputType: dialogs.inputType.email
}).then((r) => {
if(r.result = true) {
if(r.text != "") {
email.compose({
subject: "CPU Signed Form - " + this.cpuOrder.OrderNumber,
body: "See attachment.",
to: [r.text],
attachments: [
{
fileName: this.cpuOrder.OrderNumber + '-SIG.pdf',
path: this.pdfPath,
mimeType: 'application/pdf'
}]
}).then(
function() {
console.log("Email composer closed");
}, function(err) {
dialogs.alert({
title: "Email Not Sent"
,message: "Error: " + err
,okButtonText: "Ok"
});
});
}
else {
dialogs.alert({
title: "Enter a Valid Email"
,message: "Please enter an email address"
,okButtonText: "Ok"
});
}
}
})
}
else {
dialogs.alert({
title: "Email Not Supported"
,message: "This device does not support OR is not set up for emailing."
,okButtonText: "Ok"
});
}
The error reads: "File not found for path: http://cpuimages.ivansmith.com/CPUImages/SignaturePDFs/1001903LG28-SIG.pdf"
So that is going to be the value of the variable in the code.
Quite frankly, I can't access that file either:
Well you aren't going to be able to if you aren't on the correct network. I can though from a browser.
I am also displaying the PDF via another NativeScript plugin using the same variable, so the same URL. So it is not as though the app itself cannot access it.
Let’s not complicate things. Do you have the same issue with a publicly available pdf (please post an example)
Good thought. I tried replacing the variable in my code with the public URL you find here. It gives the same error.
email.available().then((avail: boolean) => {
if(avail) {
dialogs.prompt({
title: "Enter Email",
message: "Please enter the address you want to send the document to below",
okButtonText: "Send",
cancelButtonText: "Cancel",
inputType: dialogs.inputType.email
}).then((r) => {
if(r.result = true) {
if(r.text != "") {
email.compose({
subject: "CPU Signed Form - " + this.cpuOrder.OrderNumber,
body: "See attachment.",
to: [r.text],
attachments: [
{
fileName: this.cpuOrder.OrderNumber + '-SIG.pdf',
path: "https://www.adobe.com/content/dam/acom/en/devnet/acrobat/pdfs/pdf_open_parameters.pdf",
mimeType: 'application/pdf'
}]
}).then(
function() {
console.log("Email composer closed");
}, function(err) {
dialogs.alert({
title: "Email Not Sent"
,message: "Error: " + err
,okButtonText: "Ok"
});
});
}
else {
dialogs.alert({
title: "Enter a Valid Email"
,message: "Please enter an email address"
,okButtonText: "Ok"
});
}
}
})
}
else {
dialogs.alert({
title: "Email Not Supported"
,message: "This device does not support OR is not set up for emailing."
,okButtonText: "Ok"
});
}
})
Is there any update on this by chance? I have now tested this on an Android, as well as, iOS and the issue occurs on both.
I have not found time to look into it. Flagging it as "help wanted" so perhaps someone else can step in.
Does attaching PDFs work with this plugin? I am getting a 'File not Found' error for the remote URL path to the PDF, but it is the correct path and is accessible when the URL is plugged into a browser.
Thanks!