Re: How to send mail from C program on Linux

Nicholas Mc Guire <[email protected]>
Newsgroups org.kernel.vger.linux-c-programming
Message-ID <[email protected]>
On Wed, 28 Oct 2009, [email protected] wrote:

> Hi,
>
> In my project I need to send mail on Linux.
> I have used sendmail to send mail but there are failed to send mail to my gmail account.
>
well there is always ugly insecure brute force:

#include <stdlib.h>
#include <stdio.h>

int main(int argc,char ** argv){
        char cmd[128];
        sprintf(cmd,"/usr/bin/mail -v root < /tmp/mail");
        system(cmd);
        return 0;
}

hofrat
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.