maillinks [mail-file]
or
cat [mail-file] | maillinks
In a plain text email message, you will recognize URLs easily. In HTML-mails they are most of the time part of a link-tag and thus hidden by the caption text which is shown instead. Not only because, nowadays, UBE and UCE are composed with HTML, but in any case, before you take any risks, you should be aware of where the click on such a link will lead you. Hyperlinks may include directives which are likely to be addressed to a remotely running application.
Maillinks will find the URLs “behind” any hyperlink and show it in a footnote below the email-text. You can scrutinize the URL and find information about the destination, before you engage your web-browser or other tool to follow a link.
You can pipe in an email-file to maillinks and thus create macros, where the functionality is present in a mail-client. In the Mutt user-agent, to define a shortcut, you note the following lines in your .muttrc file:
macro index M "|maillinks -\n" "create link-list"
macro pager M "|maillinks -\n" "create link-list"
Now you can push the M key either in the pager or in the mail index to pipe in a selected mail to maillinks.
Consult the documentation of your own mail-client to find out if, and how macros or similar options can be configured.
Maillinks does currently not interpret any command line arguments other than the name of a mail-file to analyze.
Ω