Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Calling Exim from within C++ function

Status
Not open for further replies.

tewari68

Programmer
Jan 25, 2005
87
US
Hi,
I have to call exim from within a C++ function to send email to admin in case of any server errors.

I am calling exim as follow
Code:
 string mailcmd = "/usr/sbin/exim -bnq -f ";
 string sym = "<";
 string errfilename = "/local/tmpfile/reporterror.err";
 string mcmd = mailcmd +  " " + adminemail + " "+ fromemail + " " + sym + " "+ errfilename;
 systemCallExec = mcmd.c_str();
 system(systemCallExec);
reporterror.err file contains the error description.
adminemail is the email of the admin to whom the message is being send and fromemail is the email from field.
The actual mail command after substitution of all the variables above looks something like this
Code:
/usr/sbin/exim -bnq  -f reports@abc.com admin@abc.com <  /local/tmpfile/reporterror.err
This works fine, when I am redirecting the .err for message body, however I want to put the error description in a string and then pass that string as message body to exim.
Since I an not very familiar with exim, can anyone give me the command for passing a string as a message body while calling exim as above.

Thanks,
Tewari
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top