smtp.c
/*
** include the content of the file as body of the message
** No encoding will be done.
*/
include the content of the file as body of the message
No encoding will be done.
include the content of the file as body of the message No encoding will be done .
int include_msg_body(void)
{
    Sll
        *l,
        *msg_body_attachment_head;
    FILE
        *fp = NULL;
    Attachment
        *a;
    msg_body_attachment_head = get_msg_body_attachment_list();
    if (msg_body_attachment_head == NULL)
    {
        return(-1);
    }
    l = msg_body_attachment_head;
    a = (Attachment *) l->data;
    (void) snprintf(buf,bufsz,"Mime-version: 1.0\r\n");
    write_to_socket(buf);
    if (strcmp(a->charset,"none") != 0)
    {
        (void) snprintf(buf,bufsz,"Content-Type: %s; charset=%s\r\n\r\n",
                a->mime_type,
                a->charset);
    }
    else
    {
        (void) snprintf(buf,bufsz,"Content-Type: %s\r\n\r\n",a->mime_type);
    }
    write_to_socket(buf);
    fp=fopen(a->file_path,"r");
    if (fp == (FILE *) NULL)
    {
        errorMsg("Could not open message body file: %s",a->file_path);
        return (-1);
    } 
    while (fgets(buf,bufsz,fp))
    {
        write_to_socket(buf);
        if (g_show_attachment_in_log)
        {
            showVerbose("[C] %s",buf); 
        }
    }
    (void) fclose(fp);
    (void) snprintf(buf,bufsz,"\r\n\r\n");
    msock_puts(buf);
    showVerbose(buf);
    return(0);
}
int include_msg_body ( void ) { Sll * l , * msg_body_attachment_head ; FILE * fp = NULL ; Attachment * a ; msg_body_attachment_head = get_msg_body_attachment_list ( ) ; if ( msg_body_attachment_head == NULL ) { return ( -1 ) ; } l = msg_body_attachment_head ; a = ( Attachment * ) l -> data ; ( void ) snprintf ( buf , bufsz , " \r \n " ) ; write_to_socket ( buf ) ; if ( strcmp ( a -> charset , " " ) != 0 ) { ( void ) snprintf ( buf , bufsz , " \r \n \r \n " , a -> mime_type , a -> charset ) ; } else { ( void ) snprintf ( buf , bufsz , " \r \n \r \n " , a -> mime_type ) ; } write_to_socket ( buf ) ; fp = fopen ( a -> file_path , " " ) ; if ( fp == ( FILE * ) NULL ) { errorMsg ( " " , a -> file_path ) ; return ( -1 ) ; } while ( fgets ( buf , bufsz , fp ) ) { write_to_socket ( buf ) ; if ( g_show_attachment_in_log ) { showVerbose ( " " , buf ) ; } } ( void ) fclose ( fp ) ; ( void ) snprintf ( buf , bufsz , " \r \n \r \n " ) ; msock_puts ( buf ) ; showVerbose ( buf ) ; return ( 0 ) ; }
include the content of the file as body of the message
No encoding will be done.
include the content of the file as body of the message No encoding will be done .