问题
I'd like to have a link like so:
mailto:foo@bar.com?subject=email&body=TIMESTAMP
or
MATMSG:TO:example@example.com;SUB:email;Body:TIMESTAMP;;
But in the subject line or in the body, I'd like it to include any of these options:
- A timestamp
- Sort of message like 'Message number #' which counts the number of times it's been used
- Any sort of unique random code of gibberish
I was hoping it would be possible to somehow import the contents from another website like this or something. Is there any way to do this using a stand alone link? Ultimately, I'm hoping this link can used with a QR code.
Thanks in advance.
回答1:
At a glance I think there are 2 ways to do that:
generate the link with javascript:
document.write('<a href="mailto:foo@bar.com?subject=email_' + new (Date().getTime()) + '"></a>');
or generate the link with server side scripting, for example PHP:
<?php echo "<a href="mailto:foo@bar.com?subject=email_".round(microtime(true))."</a>" ?>
Personally I would use javascript, I think it's more appropriate for this kind of stuff.
Edit:
Even better is using a javascript bookmarklet, that way it can be used as a link:
javascript:location.href='mailto:example@example.com?SUBJECT=Data&BODY=Code:'+new Date().getTime()
来源:https://stackoverflow.com/questions/23163418/is-there-a-way-to-use-a-mailto-link-that-includes-a-timestamp-or-some-sort-of-u