简体   繁体   中英

Mailto: or alternative for sending an email

When a user clicks on an image, I would like an email to be sent with a link related to that image.

Here is the html code, currently the email opens but the link is not attached:

    <a href="mailto:?Subject=You%20have%20been%20sent%20a%20MixTape&body=Hello">
      <div id="resultsTwo"></div>
      <p id="linkTwo"></p>
    </a>

Any suggestions?

You can not add an attachment to a message with the mailto: URL scheme due security reasons:

The user agent interpreting a mailto URL SHOULD choose not to create a message if any of the headers are considered dangerous (...) Only the Subject, Keywords, and Body headers are believed to be both safe and useful. mailto: only supports header values or text/plain content.

According to RFC 2368 .

If you want to send an email with an attachement you will have to do it through server side.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM