[TriLUG] OT: C++ question
Brian Henning
brian at strutmasters.com
Mon Oct 31 12:49:04 EST 2005
One option would be to exec() sendmail to do the e-mail dirty work.
Another option would be to write your own SMTP client (it's really not
hideously difficult.. I've done it in the past) and use C/C++ libraries
for the TCP socket, etc..
As far as command-line arguments:
This may be a bone you already have, but for a C/C++ program whose main
function is declared thusly:
int main (int argc, char** argv);
argc contains the number of arguments and argv is an array of
null-terminated strings which hold the arguments.
Important gotcha, which probably doesn't apply to you (and someone
correct me if I am wrong, which I may be):
On Wintel/DOS systems,
argv[0] is the first argument
On Unix systems,
argv[0] is the name of the program.
HTH,
~Brian
Mark Freeze wrote:
> Can someone show me how to send an email from within a c++ program? Or at
> least point me in the direction of a good learning resource?
> I am writing some code to process files received from customers. The code
> parses text files that are received through ftp. What I want to do is after
> the program has finished its work, send an email to a list of predefined
> users letting them know the results of the parsing. Something like "File
> {filename_variable} was processed with {quantity_variable} records and
> {error_quantity_variable} errors." Nothing fancy... Just something to let
> them know the file was received and a few details of the processing.
> I am using the g++ compiler on breezy ubuntu if it matters about libraries,
> dependencies, etc...
> Thanks,
> Mark.
> ( My next post will probably be regarding passing command line parameters
> to the program if anyone wants to go ahead and throw me a bone on this while
> I have your attention. ;-> )
--
----------------
Brian A. Henning
strutmasters.com
336.597.2397x238
----------------
More information about the TriLUG
mailing list