[TriLUG] OT: C++ question

Warren Myers volcimaster at gmail.com
Mon Oct 31 13:41:27 EST 2005


As Brian said, you can do an exec() or system() call, passing a C string to
the function that might do a call like this:

string recipients="..."; // your recipient list
string subject = "'...'"; // subject here
for(int k=0; k<totalfiles; k++){
 string arg = "mail -s " + subject + recipients + "<" +files[k];
 system(arg.c_str());
}

ugly, but may be about what you're trying to do

On 10/31/05, Mark Freeze <mfreeze at gmail.com> 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. ;-> )
> --
> TriLUG mailing list : http://www.trilug.org/mailman/listinfo/trilug
> TriLUG Organizational FAQ : http://trilug.org/faq/
> TriLUG Member Services FAQ : http://members.trilug.org/services_faq/
>



--
http://warrenmyers.com
"God may not play dice with the universe, but something strange is going on
with the prime numbers." --Paul Erdős


More information about the TriLUG mailing list