Which programming language?What have you tried so far? Have you looked at the Python code that you linked here? Please keep in mind that Google won't like you automatically create accounts.
I got both in Python. It's just writing script to make them.
If not Gmail what about Hotmail or Outlook ect.