Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

C program using mailx

Options
  • 24-12-2005 9: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 Posts: 1,865 ✭✭✭Syth


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


Advertisement