You never check the return from open.
You also never check the result of the system()
call. Finally, you never delete the file after mailing
it. I don't know if that's on purpose or not, but if not,
you should unlink it.
Other than that, the program looks like it should work.