Advertisement
Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/.
If we do not hit our goal we will be forced to close the site.

Current status: https://keepboardsalive.com/

Annual subs are best for most impact. If you are still undecided on going Ad Free - you can also donate using the Paypal Donate option. All contribution helps. Thank you.
https://www.boards.ie/group/1878-subscribers-forum

Private Group for paid up members of Boards.ie. Join the club.

C program using mailx

  • 24-12-2005 09:37PM
    #1
    Closed Accounts Posts: 232 ✭✭


    Hi,
    I want to write a C program that sends an e-mail message from a Unix computer. In the past I have been able to do it as I have just written "mailx -s \"Subject\" someone@somewhere.com < message.txt" to buf, and then system(buf); would send the e-mail (message already written to message.txt). But now there are variables in the message, so I want the message copied to buf also (ie. message is not already written in a text file), but I can't work out how to do it... everything I have tried so far, mailx has either treated each word as another e-mail address, or mailx has sent an e-mail with no message, and then the system has tried to run each of the words in the message as a command. How do I do it?

    Thanks, and Happy Christmas!


Comments

  • Registered Users, Registered Users 2 Posts: 1,865 ✭✭✭Syth


    Could you not write the email to the file buffer.txt and then do what you just did?


Advertisement