Hello,

I'm assming you are running sendmail.   If not the procedures will be
slightly different but close.

If you have a shell script, simply construct your message either on the fly,
or through a temporary file.   Then send it to sendmail via a pipe:

$ cat <msg> | /usr/sbin/sendmail -f <sender address> <recipient address>

Of course for the -f flag to work properly, it should be run as root, if the
sender address is different from the current user.

If you are doing this out of a C language program, pretty much follow the
same steps - but instead of the command line, you'll need to do the normal
forks / execs to get a child process going (sendmail in this case), reassign
stdin on the child process (I'm going from memory here but this should be
reasonably close - in any event you need a mechanism where the parent can
write to stdin of the child), and then write the message over the pipe.
Close everything down in your program and you're done.

Oh, before I forget - make sure that the data you send to sendmail includes
both the RFC-822 headers as well as the message body.  The sendmail
arguments only set the envelope sender and recipient addresses.

Hope this is of some help.

Best Regards,

Tim Kehres
International Messaging Associates
http://www.ima.com


----- Original Message -----
From: "Wai Iu" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, August 21, 2002 9:59 PM
Subject: how to send email in a client application


> I have a redhat7.2 system running. I have an application wrriten with C
language.
> Is there any way that I can send out simple text-based email in that
application, such as using SMTP, POP3? Any suggestion will be appreciated.
>
>
>
> --
> redhat-list mailing list
> unsubscribe mailto:[EMAIL PROTECTED]?subject=unsubscribe
> https://listman.redhat.com/mailman/listinfo/redhat-list
>
>



-- 
redhat-list mailing list
unsubscribe mailto:[EMAIL PROTECTED]?subject=unsubscribe
https://listman.redhat.com/mailman/listinfo/redhat-list

Reply via email to