How to send file by sendFileByUrl method using external storage?#
To send a file via a link, you can use the following services for storing sent files:
When making mailing with files using the sendFileByUrl method, we recommend using the UploadFile method because there may be limitations on mailing when sending files using file-sharing services.
Due to the system accessing the link many times within a short period of time, file-sharing services block the retrieval of the file via link. As a result, the system generates a status notification as failed
for the message.
Sending a file via link by the sendFileByUrl method from Yandex disk#
-
Open Yandex Disk and find the file you want to send, make sure that the rights to read or view are set for everyone who has the link.
-
Select a file to send, right-click “Share” -> “Copy link”
Copied link:
https://disk.yandex.ru/i/af_Sg4D76royEQ
-
To download the file, a third-party service will be used, we use a special link:
https://getfile.dokpub.com/yandex/get/
-
To form the final link, you need to combine the links from paragraph 2 and paragraph 3 into one line. The final link will look like this:
https://getfile.dokpub.com/yandex/get/https://disk.yandex.ru/i/af_Sg4D76royEQ
-
Send the final link by the sendFileByUrl method.
This method was taken from the website.
Sending a file via link by the sendFileByUrl method from Google drive#
-
Open Google drive and find the file you want to send.
-
Select a file to send, right-click “Share” -> “Anyone with the link” -> “Viewer” ->“Copy link” -> “Done”
-
Paste the resulting link into a text editor to get the file id
For example, copied link:
https://drive.google.com/file/d/13sseEurJDYZxb-ueH2VOpVoYY4U5Kvu1/view?usp=sharing
From this link, select and copy the value between
d/
and/view
(for documents the file id is betweend/
and/edit
), in this case the file ID will be:13sseEurJDYZxb-ueH2VOpVoYY4U5Kvu1
-
Use a special link to download files by ID:
https://drive.google.com/uc?export=download&id=
-
Paste the copied file id value from paragraph 3 at the end of the link. The final link will look like this:
https://drive.google.com/uc?export=download&id=13sseEurJDYZxb-ueH2VOpVoYY4U5Kvu1
-
Send the final link by the sendFileByUrl method.
Send a file via a link using the sendFileByUrl method from Dropbox#
-
Open Dropbox and find the file you want to send.
-
Select the file and click
Share
. Make sure that the file settings indicate:Anyone with this link can view
. Copy the link to the file by clicking theCreate and copy link
orCopy link
button. -
Replace the end of the link
&dl=0
with&dl=1
. For example, link:convert to:https://www.dropbox.com/scl/fi/7dl0h3thb4569r9y8a1wc/test_cat.jpg?rlkey=c6456tj47dtfbnzj3y8pbopj2&dl=0
https://www.dropbox.com/scl/fi/7dl0h3thb4569r9y8a1wc/test_cat.jpg?rlkey=c6456tj47dtfbnzj3y8pbopj2&dl=1
-
Send the modified link using the sendFileByUrl method.
Send a file via a link using the sendFileByUrl method from ICloude Drive#
-
Open ICloud Drive and find the file you want to send.
-
Hover your mouse over it and click on the three dots. Select
Collaborate with Others...
. -
In the share options, set
Who can access
toEnyone with the link
, setView only
toPermission
and clickSend Link
. Copy the generated link. -
Open the link in the "Incognito" tab in Chrome ("private window" in Firefox/Opera or "InPrivate" in Edge) or simply in another browser.
-
Click
Download a copy
. After successful downloading, go to the browser menu and open "Downloads" (for Opera, click "Downloads" - "Show more"). Right-click on the downloaded file and select "Copy link address" ("Copy download link"/"Copy download address" depending on the browser you are using). -
Send the copied link using the sendFileByUrl method.