Thread: sendmail

  1. #1
    Registered User
    Join Date
    May 2005
    Posts
    4

    Post sendmail

    Hello.
    I have to write a short c program for sending an email. I had no problem until I realized I also have to attach a file to the email I'm sending. Is it possible, using the "sendmail" command?

    Here's what the code looks like so far:

    Code:
    fp = popen ("sendmail -t", "w");
    if (fp==NULL) 
    {
        printf("Error opening pipe\n");
        exit(0);
    }/*if*/
    fwrite(text_message, 1, strlen(text_message), fp);
    pclose(fp);
    where text_message is the message I'm sending, including To, Cc, Bcc and Subject line.

    So... how can I attach a file to the message?

    Thanks a lot for your help.

    Chris

  2. #2

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Leaking Memory in a sendmail milter I wrote?
    By stevfletchcom in forum C Programming
    Replies: 8
    Last Post: 10-10-2008, 11:30 AM
  2. need some help on email sending in C programming
    By Unregistered in forum C Programming
    Replies: 5
    Last Post: 01-13-2002, 04:36 AM