If you don't go online, no worries about security.....
.......as far as for the mail server, you need to install one, configure, and run, after you can run your scripts that contain mail() function, or what you have there.
BTW: for the mail to be send, you need to have an internet connection, or a later internet connection, presumming that the mail server will keep your mail unsent until you connect to the internet.