Skip to content

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#

  1. 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.

  2. Select a file to send, right-click “Share” -> “Copy link”

    link Yandex disk

    Copied link: https://disk.yandex.ru/i/af_Sg4D76royEQ

  3. To download the file, a third-party service will be used, we use a special link:

    https://getfile.dokpub.com/yandex/get/
    
  4. 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
    
  5. 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#

  1. Open Google drive and find the file you want to send.

  2. Select a file to send, right-click “Share” -> “Anyone with the link” -> “Viewer” ->“Copy link” -> “Done”

    link google drive

  3. 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 between d/ and /edit), in this case the file ID will be: 13sseEurJDYZxb-ueH2VOpVoYY4U5Kvu1

  4. Use a special link to download files by ID:

    https://drive.google.com/uc?export=download&id=
    
  5. 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
    
  6. Send the final link by the sendFileByUrl method.

Send a file via a link using the sendFileByUrl method from Dropbox#

  1. Open Dropbox and find the file you want to send.

  2. 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 the Create and copy link or Copy link button.

  3. Replace the end of the link &dl=0 with &dl=1. For example, link:

    https://www.dropbox.com/scl/fi/7dl0h3thb4569r9y8a1wc/test_cat.jpg?rlkey=c6456tj47dtfbnzj3y8pbopj2&dl=0
    
    convert to:
    https://www.dropbox.com/scl/fi/7dl0h3thb4569r9y8a1wc/test_cat.jpg?rlkey=c6456tj47dtfbnzj3y8pbopj2&dl=1
    

  4. Send the modified link using the sendFileByUrl method.

Send a file via a link using the sendFileByUrl method from ICloude Drive#

  1. Open ICloud Drive and find the file you want to send.

  2. Hover your mouse over it and click on the three dots. Select Collaborate with Others....

    iCloude Drive link

  3. In the share options, set Who can access to Enyone with the link, set View only to Permission and click Send Link. Copy the generated link.

  4. Open the link in the "Incognito" tab in Chrome ("private window" in Firefox/Opera or "InPrivate" in Edge) or simply in another browser.

  5. 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).

    iCloude Drive link

  6. Send the copied link using the sendFileByUrl method.