The accepted answer should not be regarded as a formal proof because it just postpones the proof of $\lim_{n\to\infty}(1+\frac{a_n}{n})^n=e^a$ to the proof of $\lim((1+\frac{1}{m_n})^{m_n})^{a_n}=(\lim(1+\frac{1}{m_n})^{m_n})^{\lim_{n\to\infty}a_n}$.
First, by the continuity of the natural logarithm, this is equivalent to showing that $\lim_{n\to\infty}n\log(1+\frac{a_n}{n})=a$. Since $\lim_{n\to\infty}a_n=a$, for sufficiently large $n$, it holds that $|a_n - a|\leq 1$.
Then for $n>2(|a_n|+1)$, it holds that $|\frac{a_n}{n}|\leq 2$. Now, when $|x|\leq \frac{1}{2}$, the natural log function is bounded by $x-\frac{x^2}{2}\leq \log(1+x)\leq x$, which gives $a_n - \frac{1}{2}\frac{a_n^2}{n} \leq n\log(1+\frac{a_n}{n})\leq a_n$. As $n$ goes to $\infty$, both the upper bound and the lower bound converge to $a$. Thus $\lim_{n\to\infty}n\log(1+\frac{a_n}{n})=a$