If you have a personal relationship with the professor, it is socially acceptable and may be even the norm to do so. That is however typically only the case in my area when you work with them as an assistant, are doing a thesis with them or have a very small specialist class. If you only know him from hearing a lecture of 50+ students, it might well appear that you consider your relationship more personal than it is, i.e. are slightly violating social norms. However, this should normally just be taken as an oddity. So if you err in that direction it's no big deal, but it's also no issue if you don't send a mail in basically all cases that fit the question. So you can relatively safely do what feels right to you.
As a guideline, the more you already know about him beyond his professional capacity, the more likely it will be seen as appropriate. And the more your relationship so far has been distanced and purely professional the more likely it may come of as odd. A simple check is also to consider how many other students would be at the same level of closeness. When you announce something like this, a handful of mails from people that you know is sweet. Five hundred mails from five hundred peoples whose names you don't know unless you look into your student register is more a (still well meant) nuisance than a help to most people.