Skip to content Skip to sidebar Skip to footer

How To Attach Blob File Into Html Href="mailto:"

I have a file available through an URL (need authorization). I created a mailto: link and would like to attach this file in the mail. How can I do that ? Something like 'mailto:tot

Solution 1:

mailto: doesn't support attachments, but there are various ways you could achieve a similar effect:

  1. Link to the file in a message body

    You mentioned that the link needs authorisation, you could generate temporary urls that last 30 minutes (or more/less) which allow for downloads (users can then attach the file themselves)

  2. Send the email yourself

    Your service could send an email to your user (or on behalf of your user) with the attachment using something like Amazon SES, or Mailchimp, etc...

  3. Render your PDF into HTML

    It seems you are planning on attaching PDF files. Depending on the complexity of the PDF files, you could attempt to convert the PDF into email-friendly HTML using one of many tools, such as pdf2htmlEX or Pandoc.

Solution 2:

If you're hoping for an universal solution, you can't. The mailto protocol described in the RFC 2368 tells us :

The creator of a mailto URL cannot expect the resolver of a URL to understand more than the "subject" and "body" headers.

Even though other headers might be used and understood by some mail clients, this isn't an universally compatible solution. Unless you tell your clients to open these links specifically with a specific mail client that you know supports more headers (like a hypothetical attachment header), you should consider this to not be doable.

Post a Comment for "How To Attach Blob File Into Html Href="mailto:""