# Changing case of URL in \href argument

I would like to write a macro similar to the \href command from the hyperref package, but which takes a single argument. The URL is generated by making the argument lowercase.

Here is a minimal example:

\documentclass{article}
\usepackage{hyperref}

\begin{document}
\end{document}

However, the \lowercase command is not expanded, and the link points to www.\lowercase{MyURL}.com. Is there a way to solve this problem?

-

will work.

As requested in comments a more complicated example:

\documentclass{article}
\usepackage{hyperref}

\newcommand\mymail[2]{%
\lowercase{\def\tmpa{#1}}%
\uppercase{\def\tmpb{#2}}%
\href{mailto:\tmpa.\tmpb}{#1.#2}}

\begin{document}