smtp.c
/*
** send one line messages, each one is an inline attachment
** return 0 if mail is sent, -1 otherwise
*/
send one line messages, each one is an inline attachment
return 0 if mail is sent, -1 otherwise
send one line messages each one is an inline attachment return 0 if mail is sent - 1 otherwise
int process_oneline_messages(const char *boundary)
{
    Attachment
        *a = NULL;
    Sll
        *l,
        *oneline_attachment_list;
    oneline_attachment_list = get_oneline_attachment_list();
    if (oneline_attachment_list == NULL)
    {
        return(0);
    }
    print_oneline_attachment_list();
    for (l = oneline_attachment_list; l; l = l->next)
    {
        a = (Attachment *) l->data;
        (void) snprintf(buf, bufsz, "\r\n--%s\r\n",boundary);
        write_to_socket(buf);
        if (strcmp(a->charset,"none") != 0)
        {
            (void) snprintf(buf, bufsz, "Content-Type: %s; charset=%s\r\n",
                a->mime_type,
                a->charset);
        }
        else
        {
            (void) snprintf(buf, bufsz, "Content-Type: %s\r\n",a->mime_type);
        }
        write_to_socket(buf);
        (void) strcpy(buf,"Content-Disposition: inline\r\n");
        write_to_socket(buf);
        if (strncmp(a->content_transfer_encoding,"none",4) != 0)
        {
            (void) snprintf(buf, bufsz, "Content-Transfer-Encoding: %s\r\n\r\n",
                    a->content_transfer_encoding);
            write_to_socket(buf);
        }
        if (strncmp(a->content_transfer_encoding,"base64",6) == 0)
        {
            encode2base64andwrite2socket(a->oneline_msg);
        }
        else
        {
            if (strncmp(a->content_transfer_encoding,"none",4) == 0)
            {
                write_to_socket("\r\n");
            }
            write_to_socket(a->oneline_msg);
            if (g_show_attachment_in_log)
            {
                showVerbose("[C] %s\n",a->oneline_msg);
            }
        }
        write_to_socket("\r\n");
    }
    return(0);
}
int process_oneline_messages ( const char * boundary ) { Attachment * a = NULL ; Sll * l , * oneline_attachment_list ; oneline_attachment_list = get_oneline_attachment_list ( ) ; if ( oneline_attachment_list == NULL ) { return ( 0 ) ; } print_oneline_attachment_list ( ) ; for ( l = oneline_attachment_list ; l ; l = l -> next ) { a = ( Attachment * ) l -> data ; ( void ) snprintf ( buf , bufsz , " \r \n \r \n " , boundary ) ; write_to_socket ( buf ) ; if ( strcmp ( a -> charset , " " ) != 0 ) { ( void ) snprintf ( buf , bufsz , " \r \n " , a -> mime_type , a -> charset ) ; } else { ( void ) snprintf ( buf , bufsz , " \r \n " , a -> mime_type ) ; } write_to_socket ( buf ) ; ( void ) strcpy ( buf , " \r \n " ) ; write_to_socket ( buf ) ; if ( strncmp ( a -> content_transfer_encoding , " " , 4 ) != 0 ) { ( void ) snprintf ( buf , bufsz , " \r \n \r \n " , a -> content_transfer_encoding ) ; write_to_socket ( buf ) ; } if ( strncmp ( a -> content_transfer_encoding , " " , 6 ) == 0 ) { encode2base64andwrite2socket ( a -> oneline_msg ) ; } else { if ( strncmp ( a -> content_transfer_encoding , " " , 4 ) == 0 ) { write_to_socket ( " \r \n " ) ; } write_to_socket ( a -> oneline_msg ) ; if ( g_show_attachment_in_log ) { showVerbose ( " \n " , a -> oneline_msg ) ; } } write_to_socket ( " \r \n " ) ; } return ( 0 ) ; }
send one line messages, each one is an inline attachment
return 0 if mail is sent, -1 otherwise
send one line messages each one is an inline attachment return 0 if mail is sent - 1 otherwise
/* add encoding type if needed */ /* encode the mssage to base 64 and write to socket */ /*
            ** no encoding type, so last \r\n was no added, we must
            ** add it or some mailer will thing the mail is invalid
            */