0

Is there a simple tool that just dumps the content of a mailto link to console?

$ decode_mailto 'mailto:[email protected]?subject=qqq&body=www%20eee&'
To: [email protected]
Subject: qqq

www eee
2
  • Why not just click on it, and it will appear in your e-mail client, correctly formatted? You don't have to send it.
    – AFH
    Dec 12, 2014 at 16:18
  • The mailto: link may be generated outside normal desktop environment where e-mail client may work.
    – Vi.
    Dec 12, 2014 at 16:20

1 Answer 1

3
$ cat decode_mailto 
#!/bin/bash
perl -lpe 's/%([0-9a-fA-F]{2})/chr(hex($1))/eg;s/mailto:/To: /g;s/subject=/Subject: /g;s/body=/\n/g;s/[&?]/\n/g'

$ chmod 755 decode_mailto 

$ echo 'mailto:[email protected]?subject=qqq&body=www%20eee&' | ./decode_mailto
To: [email protected]
Subject: qqq

www eee


$ 
1
  • Update for actual HEX-code, not just bare DEC-numbers (mindlapse).
    – Hannu
    Dec 15, 2014 at 16:46

Not the answer you're looking for? Browse other questions tagged .