Hi guys,
I've been programming all my CGI scripts in Perl and now want to change over to C++ to speed them up a bit.
I've got a simple email submit program that I wrote in Perl and I'm not sure how to go about it in C++, I want to connect to the mail server using sockets but I want the program to be able to compile under Unix and Win32. I know I could pipe the contents of my email to sendmail but thats no good for Windows.
Here is what I want to do in C++:
$remote=IO::Socket::INET->new("localhost:smtp(25)"
;
$remote->autoflush();
print $remote "HELO\r\n";
$trash=<$remote>;
print $remote "MAIL From: $from \r\n";
$trash=<$remote>;
print $remote "RCPT To: $to \r\n";
$trash=<$remote>;
print $remote "DATA\r\n";
$trash=<$remote>;
print $remote $content;
print $remote "\r\n.\r\n";
$trash=<$remote>;
print $remote "QUIT\r\n";
$trash=<$remote>;
close($remote);
Any help appreciated.
I've been programming all my CGI scripts in Perl and now want to change over to C++ to speed them up a bit.
I've got a simple email submit program that I wrote in Perl and I'm not sure how to go about it in C++, I want to connect to the mail server using sockets but I want the program to be able to compile under Unix and Win32. I know I could pipe the contents of my email to sendmail but thats no good for Windows.
Here is what I want to do in C++:
$remote=IO::Socket::INET->new("localhost:smtp(25)"
$remote->autoflush();
print $remote "HELO\r\n";
$trash=<$remote>;
print $remote "MAIL From: $from \r\n";
$trash=<$remote>;
print $remote "RCPT To: $to \r\n";
$trash=<$remote>;
print $remote "DATA\r\n";
$trash=<$remote>;
print $remote $content;
print $remote "\r\n.\r\n";
$trash=<$remote>;
print $remote "QUIT\r\n";
$trash=<$remote>;
close($remote);
Any help appreciated.