First create a shell script that sends an email tailored to your needs,
#! /usr/local/bin/tcsh -f
mail paciorek << -end-
Finished executing MCMC run with output $1 and $2 iterations.
Save this file, e.g. as mail.csh, and make sure it is executable using
>chmod guo+x mail.csh. Next, in your C++ program, call the
script, including the two arguments used by the script
string cmd=source mail.csh ;
Note that num_its here would need to be a string, so you would have to convert from an integer to a string for this approach to work.