简体   繁体   中英

Include Timestamp in mailto: subject

I want to include a timestamp in the subject of a mail. I already found out that I have to use javascript for this, I also found a way to include it, but I have trouble displaying the mail adress on the webpage (nothing is displayed). Below is the code I wrote until now. I think it has to do something with the way I included html in my javascript, but I can't find my error.

    <script> 
Document.write('<a href="mailto:example@example.de?subject=This is my subject' + new (Date().getTime())+'">example@example.de</a>);
</script>

The snippet of code I used is this one:

document.write('<a href="mailto:foo@bar.com?subject=email_' + new (Date().getTime()) + '"></a>');

A possible solution can be:

'<a href="mailto:foo@bar.com?subject=email_' + Date.parse(Date()) + '"></a>'

You really shouldn't be doing this, for two reasons:

It's better to send mails from your webserver which would also solve your subject problem.

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