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


 
Thread Tools Search this Thread
Top Forums Programming How to send a file in e-mail from on Linux C++?
# 1  
Old 08-24-2015
Hammer & Screwdriver 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 !
# 2  
Old 08-24-2015
Look for the system call; something like this
Code:
system("cat /config-directory/filename.type | mailx -s 'subject' user@host");

# 3  
Old 08-24-2015
i can add thsi line in my program after compile ?
Or run from a shell script ?

i trying from console, but:

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

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

Client was not authenticated to send anonymous mail during MAIL FROM (in reply to MAIL FROM comm

I am having trouble getting mail to work on a red hat server. At first I was getting this message. Diagnostic-Code: X-Postfix; delivery temporarily suspended: connect to :25: Connection refused Then added the port to my firewall. Then I temporarily turned off selinux. I then copied this file... (1 Reply)
Discussion started by: cokedude
1 Replies

2. UNIX for Beginners Questions & Answers

Not able to send mail on my company's account but gmail in Linux 6.8

On Red Hat Enterprise Linux Server release 6.8. I am to get the email from my LINUX box on gmail account but it fails on company domain. getting status=sent for gmail. BUT getting below error for company domain: status=bounced #5.1.8 Domain of sender address <root@xxxx.com> does not exist... (16 Replies)
Discussion started by: nadeemrafikhan
16 Replies

3. Red Hat

unable to send mail from redhat linux server

While sending mail from linux server we observed below logs, stat=Deferred: Name server: xxxxxxxxxx.: host name lookup failure Kindly suggest what we need to change? Thanks in Advance (2 Replies)
Discussion started by: hydoss1
2 Replies

4. Shell Programming and Scripting

I have a requirement to check whose accounts are expired in Linux machine and send a mail to root

I have a requirement to check whose accounts are expired in Linux machine and send a mail to root user about the accounts. How can i achieve this in Linux? (1 Reply)
Discussion started by: mnmonu
1 Replies

5. Shell Programming and Scripting

no command is not working to send a mail in linux redhot server

HI All, I am facing the problem with rmail ... Actually my server is linux environment Redhot server. To send a mail which command I have to use it . I want subject and I want to Include CC also And body of the mail also there . But If I use rmail command it is not taking any options to... (1 Reply)
Discussion started by: ksrivani
1 Replies

6. UNIX for Advanced & Expert Users

need to configure mail setting to send mail to outlook mail server

i have sun machines having solaris 9 & 10 OS . Now i need to send mail from the machines to my outlook account . I have the ip adress of OUTLOOK mail server. Now what are the setting i need to do in solaris machines so that i can use mailx or sendmail. actually i am trying to automate the high... (2 Replies)
Discussion started by: amitranjansahu
2 Replies

7. UNIX for Dummies Questions & Answers

How to send html file in a mail not as an attachment but it should display in the mail in table for

Hi The below script working when we are sending the html as attachment can u please guide how to send thesmae data in table form direct in the mail and not in mail attachment . cat Employee.sql SET VERIFY OFF SET PAGESIZE 200 SET MARKUP HTML ON SPOOL ON PREFORMAT OFF ENTMAP ON - HEAD... (0 Replies)
Discussion started by: mani_isha
0 Replies

8. UNIX for Dummies Questions & Answers

How to send file in mail

Hi I want to send out a file that generate 1st of each month that have formate like this 11012008_experience_rate_log.txt Now I have setup a cronjob that usually sent this file in mail like cat /data02/transfer/*_experience_rate_log.txt | mail -s 'PICS EXP RATE Logs' lger@bd.com So how... (3 Replies)
Discussion started by: vishalpatel03
3 Replies

9. Shell Programming and Scripting

Send mail from linux

Hi, Could any one get me suggested how to send a mail from a linux server to any external user? I tried the following : $ mail abc@xyz.com Subject: test Hi, This is a test mail. . Cc: def@xyz.com But I haven't recived any mail at abc@xyz.com and def@xyz.com Kindly help on... (2 Replies)
Discussion started by: yogi_4984
2 Replies

10. Shell Programming and Scripting

Pull E-mail address from file, send e-mail

Hello, I am new to perl and need to create a script that will read a file and pull a name from the file and send e-mail. How can I use the following awk statement in a perl script? grep UNIXadmins /root/mail.conf | awk '{ print $2}' and use the output to send a e-mail. Any help would... (1 Reply)
Discussion started by: DC Heard
1 Replies
Login or Register to Ask a Question