urgent:how to send email using c program

Posted on 2006-05-21
Medium Priority
Last Modified: 2010-04-21
I am new to linux enviroemnt. I have linux Fedora core server. I want to write a c program and compile using gcc so that i can send email to any client. I have not make any configuration to mail server but sendmail is running on server. I do not need to receive any mail. i just want to send mail.

Question by:ibm979
  • 2
  • 2
  • 2
  • +1
LVL 23

Expert Comment

ID: 16729139
I would use popen("/usr/bin/mail -s 'Subject line' recipient@domain") to invoke the mail command, then write the body of the message into the pipe.


Author Comment

ID: 16729161
this command is not working as i am using linux fedora core fore. I am trying to use sendmail command but the command runs but the message is not being delivered to the recipetant.

 sendmail -v abdullahmansoor@hotmail.com
hi. it is a test message
abdullahmansoor@hotmail.com... Connecting to [] via relay...
220 telemedicine.com ESMTP Sendmail 8.13.4/8.13.4; Sun, 21 May 2006 23:42:32 +0500
>>> EHLO telemedicine.com
250-telemedicine.com Hello localhost.localdomain [], pleased to meet you
250 HELP
>>> MAIL From:<root@telemedicine.com> SIZE=25 AUTH=root@telemedicine.com
250 2.1.0 <root@telemedicine.com>... Sender ok
>>> RCPT To:<abdullahmansoor@hotmail.com>
>>> DATA
250 2.1.5 <abdullahmansoor@hotmail.com>... Recipient ok
354 Enter mail, end with "." on a line by itself
>>> .
250 2.0.0 k4LIgWRv030194 Message accepted for delivery
abdullahmansoor@hotmail.com... Sent (k4LIgWRv030194 Message accepted for delivery)
Closing connection to []
>>> QUIT
221 2.0.0 telemedicine.com closing connection
[root@telemedicine mail]#
LVL 23

Expert Comment

ID: 16729191
It sounds like you have not properly configured sendmail to forward outgoing mail to your ISP.
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.


Author Comment

ID: 16729590
what configuration i have to do?
LVL 35

Expert Comment

by:Duncan Roe
ID: 16738161
In your distribution you should have received an "op" directory which contains at least Makefile and op.me. Makk will make op.ps, if it's not there already. Also it will make op.txt or op.pdf if you'd prefer them.
One of them should tell you all you want to know (100 pages approx) .
Personally I use qmail because it's a much simpler system to administer IMHO
LVL 35

Expert Comment

by:Duncan Roe
ID: 16738167
Makk = mis-typed for Make ;)
LVL 24

Accepted Solution

slyong earned 2000 total points
ID: 16740925
If you want to directly connect to any SMTP server (not via the mail command), you can have a look at the C program here: http://www.muquit.com/muquit/software/mailsend/mailsend.html

Featured Post

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The purpose of this article is to fix the unknown display problem in Linux Mint operating system. After installing the OS if you see Display monitor is not recognized then we can install "MESA" utilities to fix this problem or we can install additio…
The purpose of this article is to demonstrate how we can upgrade Python from version 2.7.6 to Python 2.7.10 on the Linux Mint operating system. I am using an Oracle Virtual Box where I have installed Linux Mint operating system version 17.2. Once yo…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an anti-spam), the admin…
Look below the covers at a subform control , and the form that is inside it. Explore properties and see how easy it is to aggregate, get statistics, and synchronize results for your data. A Microsoft Access subform is used to show relevant calcul…
Suggested Courses
Course of the Month13 days, 19 hours left to enroll

807 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question