Support Topics Documentation Slack YouTube Blog

Email API failing with link to file

Hello, i’m using SDK 5.5.0 Xcode 11.2

My app creates PDF files saves them to Backendless then emails them to the user.
99% of the time the attachment works, but every so often the email comes without the attachment.
As a work around Im trying to include a link to the file in the email so the user can download it manually if need be.
The problem is the email fails to send if I include a link to the file. as I test I used a PDF link from my server and it works fine.
Is it because the file link includes the app ID and IOS key?
Is there a better work around?

Hello @robert-j

No, IOS key should not effect, at least if you do not have any specific permissions for File Service

Could you please provide us with request payload details (bodyText, bodyHtml, attachments, …) of sending emails which are failing, you can hide any sensitive data from that.

Does the link for pdf file work in browser?

Regards, Vlad

Yes the file will open in a browser.
I stripped all the HTML from the email body and only included the link I PM’ed you and it fails.

could you please share how this HTML body looks like

// Doesnt Send
body.htmlMessage = "https://backendlessappcontent.com/07AA8A6D-813C-1762-FF8C-B3F874B66F00/E5C5077C-FCFB-499F-B0D9-985C7A29865D/files/test.pdf"
//Does Send
body.htmlMessage = "https://nextgen-systems.com/test.pdf"

try to wrap it into HTML tag “a”

<a href="YOUR_URL">YOUR_URL</a>

also when you say “Doesnt Send” you mean the request fails, is there any error?

No error. The email just never shows up.

I tried changing it to plain text also, same thing

//Doesnt Send
Tbody.textMessage = "https://backendlessappcontent.com/07AA8A6D-813C-1762-FF8C-B3F874B66F00/E5C5077C-FCFB-499F-B0D9-985C7A29865D/files/test.pdf"
//Works
Tbody.textMessage = "https://nextgen-systems.com/test.pdf"

Are you able to trace a message ID?
MessageStatus> messageId: mail:E2FA038C-93B7-46D5-FF22-691470F9F200, status: SCHEDULED errorMessage: (null)

What SMTP server do you use?
I assume, those emails might be recognized as phishing https://help.campaignmonitor.com/avoid-looking-like-a-phisher

Ughh, that’s the issue, iCloud and gmail aren’t delivering them, but using a email on my server it comes through.

Any chance you could incorporate a link shortener as a work around? Any other ideas?

You should be able to shorten the link in your code when you compose an email.

Regards,
Mark

Solved with this