I'm developing a dynamic library for notifications, this library is used for a daemon that i've programmed, when something goes wrong the library should send an email to an administrator, but since sending an email is a non-vital process then it can fail (it should work as an asynchronous process) so i'm considering to do that by using the fork function, however the entire process of daemon will be forked and i would be responsible for destroying the child process, so my question is, does exist any way more efficient to do this?
Sending email using a command like mailx or sendmail requires a fork/exec on the child
side then wait on the parent side. This is exactly what the system() call does.
The alternative is to do what sendmail does in C code. system("/usr/bin/sendmail ... ") being infinitely simpler. IF you're sending 100K mail messages per day you should incorporate sendmail code, otherwise for a few dozen messages per day, consider system().
Start here to see what sendmail does, it is open source.