>>sprintf(mail_command,"mail -s %s %s ",subject,recpt);
A classic example of a security hazzard. As twm implied, who knows what "mail" actually is. You should be using the full path to the executable: /usr/bin/mail (or whatever)