#include <stdlib.h>
#include <stdio.h>
void send_email( const char *to, const char *from, const char *subject, const char *data )
{
FILE *fp;
if ( ( fp = popen( "ruby1.9 /path/to/sendemail.rb", "w" ) ) == NULL ) {
fputs( "Couldn't connect to sendmail script.\n", stderr );
exit( EXIT_FAILURE );
}
fputs( from, fp );
fputs( to, fp );
fputs( subject, fp );
fputs( data, fp );
pclose( fp );
}
int main()
{
send_email( "noreply@example.org", "noreply@example.org", "test email", "email contents" );
exit( EXIT_SUCCESS );
}
<from>\n
<to>\n
<subject>\n
<data>
system( "ruby1.9 /path/to/sendemail.rb < email_file" );
HELO mud@spam.net
MAIL FROM: mud@spam.net
RCPT TO: victim@game.org
DATA
This is some email spam for you!
.
QUIT