Difficulty sending email

Hi, I am attempting to send an email template when a form is submitted and am getting an error related to the path of the attachment. I have searched for other threads on this and referred to the documentation here:
https://backendless.com/docs/js/email_send_email_with_templates_api.html#codeless-reference

App ID: 552EA923-D13D-8DAB-FFF1-BBC86963EF00
Page: feedback

Codeless:

Result:

I get the filepath originally on Upload Success for the upload button itself:
image

In the UI Builder, under “Directory”, I specified “/Images/Screenshots”. Multiple files is not selected.

I’ve tried multiple different variations on the filepath including the entire URL, /Images/…, Images/…, /files/…, and files/… I can’t seem to find the right combination. Could you help me identify what I’m doing wrong?

Please check what the request looks like in the Network tab of the browser’s DevTools. You should be able to see the entire payload for the request.

The path should be Images/Screenshots/FILENAME.jpeg

Thanks Mark!

I adjusted the file path to make sure that it matches your format. Here is the result:

Here is the network tab output as well:



I apologize, I misguided you. The path for the attachments must start with a leading slash. So it should be

/Images/Screenshots/FILENAME.jpeg

Thanks Mark. I had tried that as well and it also didn’t work. In subsequent testing just now though I noticed that it does complete successfully for a file that is “headshot.jfif”. I repeated with a few other files and those without spaces in the names are all successful. (FYI, I don’t seem to be receiving the emails so there’s another issue but that’s separate.)

For purposes of attachments is there a chance that the file name can’t have any spaces that then get replaced with “+”? My users are certain to upload things with spaces so I’ll need to trim out the spaces in some way if that’s the case.

Hi @James_Hereford,

To avoid possible bugs, it is better to trim spaces in names and save files without spaces.

Regards,
Bohdan

Hi James,

Try encoding the attachment path using the following block:

UI Builder - default - ConsoleDemo - Backendless 2024-05-14 08-57-52

Regards,
Mark

Thanks guys! I am waiting for some IT things with email setup on my end and then I will revisit and test these solutions.

Regards,
James

Thanks @mark-piller and @Bohdan_Vynarchuk

I tried encode URI and it still returned the Invalid Path error. I tried to remove the ‘create list with’ block but encode URI wouldn’t connect directly to the Send Email block.

The upload function already removes spaces. The value being passed into the attachments URL is:
image
…which works fine when the uploaded file has no spaces.

I suspect that it has something to do with spaces being replaced with ‘+’ symbols. I took a file that had sent successfully before and added a ‘+’ into the filename. This time the upload tool replaced the '+ with ‘%2B’. The block returned the same invalid path error, which makes me suspect it has to do with special characters in general.
image

Thoughts?