LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   Sending email from within a C program (https://www.linuxquestions.org/questions/programming-9/sending-email-from-within-a-c-program-344324/)

KeitgB 07-18-2005 12:27 PM

Sending email from within a C program
 
Is there an API available to send email from within a C program on Linux?

paulsm4 07-18-2005 02:07 PM

One possibility:

system ("echo SOME STUFF | mail -s 'MY SUBJECT' SOMEBODY@somewhere.com");

exvor 07-18-2005 04:04 PM

you can also use a popen with sendmail


this works just like working with files on the harddrive

Code:


FILE *command;

command = popen ( "ps -A"."r");



this code would put the output of ps -A into the stream command that you could parse with sscanf or some other function to get the data or work with it.


All times are GMT -5. The time now is 03:07 PM.