I am running Red Hat Linux 7.3 on my server. The linux kernel is "2.4.18-5". I have an application running on this server. Whenever the server is rebooted I would like to send an e-mail out to an administrator from within this application. I have tried the following piece of code to be convinced about the possibility but to no avail. Would any knowledgeable source help me out here?
The sample code is:
int main (void)
{
execl ("/bin/mail", "/bin/mail", "-s Test", "joe@yourtown.com < /tmp/relInfo.c", (char *)0);
}
When I cmpile the above code and execute then ti prompts me for "Message body", "Cc", and then it complains that "/tmp/relInfo.c" cannot be found.
When I execute the command "mail -s Test
joe@yourtown.com < /tmp/relInfo.c" the mail is sent out without any problem.
Thanks in advance for all helpful suggestions
Srini