Sending mail to the Professor for PhD, after seeing his tweet
That is perfectly fine.  The professor chose to use twitter as a medium of announcing the position.  They are expecting responses to that advertisement.  It's always a good idea to explain how you heard about the position.  Your email does all of those things.