Subject: Sending Multiple Attachments

From: "Dileep Katta" <[email-masked]>
Date: Fri, 30 Jun 2000 16:45:25 -0400

Hi,

I am new to c-client. I am trying to send multiple attachments.
I couldnt figure out the right way. There seems to be a mismatch between the
internal.txt
documentation and the header files.
>From my code, only one attachment (BODY1) goes through.
Can someone please tell me what I am doing wrong?
My code piece follows.

Thanks,
Dileep

/************** BODY2 ************************/
if (stat("/tmp/crap1.doc", &file_stat) == -1) {
        printf("Cannot access %s \n", location);
        return;
}
file_size = file_stat.st_size;
stream_buf2 = (void *)malloc(file_size);
printf("Attach - crap1.doc size %d \n", file_size
fh1 = open( location, O_RDONLY);
read_size = read(fh1, stream_buf, file_size);
if (read_size != file_size)
        printf("Problem: ReadSize:%d, FileSize:%d

body2->encoding = ENCBINARY;
body2->type = TYPEAPPLICATION ;

param_attachment2->attribute = strdup("filename")
param_attachment2->value = strdup("crapdoc.doc");
param_attachment2->next = NULL;

body2->parameter = param_attachment2;

body2->disposition.type = strdup("attachment");
body2->disposition.parameter = param_attachment2;

body2->subtype = strdup("mycrapdoc.doc");
body2->contents.text.data = (void *) stream_buf;
body2->contents.text.size = file_size;
body2->size.bytes = (int) (file_size / 8);
body->nested.part = mail_newbody_part();
body->nested.part->body = *body2;
/************** BODY 1 Follows ************************/

body->encoding = ENCBINARY;
body->type = TYPEAPPLICATION ;

head->description  =  strdup("mail");

param_attachment->attribute = strdup("filename");
param_attachment->value = strdup(strrchr(location,'/')+1);
param_attachment->next = NULL;

body->parameter = param_attachment;

body->disposition.type = strdup("attachment");
body->disposition.parameter = param_attachment;

body->subtype = strdup(location);
body->contents.text.data = (void *) stream_buf;
body->contents.text.size = file_size;
body->size.bytes = (int) (file_size / 8);

head->type = TYPEMULTIPART;
head->nested.part = mail_newbody_part();
head->nested.part->body = *body;
............................
smtp_mail (stream,"MAIL",msg,head)

-- 
------------------------------------------------------------------
 For information about this mailing list, and its archives, see: 
 http://www.washington.edu/imap/c-client-list.html
------------------------------------------------------------------