In general, you can, of course. In your specific code example, you are using GMail, which does not allow anonymous submission.
From their link :
smtp.gmail.com (use authentication)
Use Authentication: Yes
Port for TLS / STARTTLS: 587
Port for SSL: 465
Additional comment regarding your catch clause:
In my opinion, you greatly abuse the idea of exclusion. A better aproach would be something like:
catch(Exception x) { var s = x.Message; if ( x.InnerException!=null ) { s += Environment.NewLine + x.InnerException.Message; } MessageBox.Show(s); }
source share