After publish node send email to someone
Why not just use Rules to do this. You'll have to watch a few tutorials to wrap your head around rules, but you won't have to re-invent the wheel or maintain any code.

If you need the custom module solution, check these out.

Check if node is being published: 
How can I detect when a node is changed from &#39;Published&#39; to &#39;Unpublished&#39;?

Then, use drupal_mail() to send your emails.