How to send a file in e-mail from on Linux C++?

Hi !

I-m copile from source a C++ program from tutorials from internet. I don't understendig any programing languages.. but compiled aplication running ok.

I-ts possible to add in my used program, lines to send one file from config directory in e-mail, to my e-mail adress ?

I want to run this script only a new start of program, and the code hawe be compiled in my used aplication.

I-ts possible to ad this lines in my compiled aplication ?
I preffer simplified intervention in my application.

Sorry for my bad english !

Look for the system call; something like this

system("cat /config-directory/filename.type | mailx -s 'subject' user@host");

i can add thsi line in my program after compile ?
Or run from a shell script ?

i trying from console, but:

mailx: cannot send message: Process exited with a non-zero status