mail$message_select problem - VMS

This is a discussion on mail$message_select problem - VMS ; Hello, could anybody help me. I will select specific emails from the folder "NEWMAIL". This is only a short form: struct { short length; /* Length of buffer in bytes */ short code; /* Item code value */ void *address; ...

+ Reply to Thread
Results 1 to 3 of 3

Thread: mail$message_select problem

  1. mail$message_select problem

    Hello,

    could anybody help me. I will select specific emails from the folder
    "NEWMAIL".

    This is only a short form:




    struct
    {
    short length; /* Length of buffer in bytes */
    short code; /* Item code value */
    void *address; /* Buffer address */
    int *retlen; /* Address of longword for returned length */
    } null_items[] = {0,0,0,0};


    struct
    {
    short length; /* Length of buffer in bytes */
    short code; /* Item code value */
    void *address; /* Buffer address */
    int *retlen; /* Address of longword for returned length */
    }
    message_select_in_items[4], message_select_in_null_items = {0,0,0,0};

    struct
    {
    short length; /* Length of buffer in bytes */
    short code; /* Item code value */
    void *address; /* Buffer address */
    int *retlen; /* Address of longword for returned length */
    }
    message_select_out_items[4], message_select_out_null_items = {0,0,0,0};


    char DefaultMailfoder[32] = "NEWMAIL";
    char MessageFrom[32] = "SECUR::SYSTEM";

    int messages_selected = 0;



    status = mail$mailfile_begin ( &file_context, null_items, null_items );

    status = mail$mailfile_open ( &file_context, null_items, null_items );

    status = mail$mailfile_info_file ( &file_context, mailfile_info_items,
    null_items );

    status = mail$message_begin ( &message_context, message_in_items,
    null_items );


    message_select_in_items[0].length = sizeof ( DefaultMailfoder );
    message_select_in_items[0].code = MAIL$_MESSAGE_FOLDER;
    message_select_in_items[0].address = &DefaultMailfoder;
    message_select_in_items[0].retlen = 0;

    message_select_in_items[1] = message_select_in_null_items;

    message_select_out_items[0].length = sizeof ( messages_selected );
    message_select_out_items[0].code = MAIL$_MESSAGE_SELECTED;
    message_select_out_items[0].address = &messages_selected;
    message_select_out_items[0].retlen = 0;

    message_select_out_items[1] = message_select_out_null_items;

    status = mail$message_select ( &message_context,
    &message_select_in_items, &message_select_out_items );

    printf ( "Total of %d messages\n", messages_selected );

    status = mail$message_end ( &message_context, null_items, null_items );
    status = mail$mailfile_close ( &file_context, null_items, null_items );
    status = mail$mailfile_end ( &file_context, null_items, null_items );

    _AXP/SYSTEM> run CHECK_MAIL
    Total of 2 messages
    _AXP/SYSTEM>

    _AXP/SYSTEM> mail

    You have 2 new messages.

    MAIL> dir

    NEWMAIL
    # From Date Subject

    1 SECUR::SYSTEM 9-MAY-2008 Solch ein Mist!
    2 SECUR::SYSTEM 9-MAY-2008

    MAIL>

    That's ok.

    But when i use the following item list to select the mail folder and the
    message from field together:


    message_select_in_items[0].length = sizeof ( DefaultMailfoder );
    message_select_in_items[0].code = MAIL$_MESSAGE_FOLDER;
    message_select_in_items[0].address = &DefaultMailfoder;
    message_select_in_items[0].retlen = 0;

    message_select_in_items[1].length = sizeof ( MessageFrom );
    message_select_in_items[1].code = MAIL$_MESSAGE_FROM_SUBSTRING;
    message_select_in_items[1].address = &MessageFrom;
    message_select_in_items[1].retlen = 0;

    message_select_in_items[2] = message_select_in_null_items;

    status = mail$message_select ( &message_context,
    &message_select_in_items, &message_select_out_items );


    _AXP/SYSTEM> run CHECK_MAIL
    Total of 0 messages
    _AXP/SYSTEM>


    What i do wrong ?

    Thank you very much for a hint.

    Klaus



  2. Re: mail$message_select problem

    In article <482c6259$0$1521$9b622d9e@news.freenet.de>, "Klaus-D. Bohn" writes:
    >
    >
    > What i do wrong ?
    >


    I suspect if you bothered to check the status value you captured
    from each function call, one of them might tell you.

    Perhaps you are trying to do two things at once that cannot
    be done together.


  3. Re: mail$message_select problem

    Thank you for all people for the help ;-))).

    I could solve my problem self.

    Please, don't ask ;-).

    Thanks

    Klaus

    "Klaus-D. Bohn" schrieb im Newsbeitrag
    news:482c6259$0$1521$9b622d9e@news.freenet.de...
    > Hello,
    >
    > could anybody help me. I will select specific emails from the folder
    > "NEWMAIL".
    >
    > This is only a short form:
    >
    >
    >
    >
    > struct
    > {
    > short length; /* Length of buffer in bytes */
    > short code; /* Item code value */
    > void *address; /* Buffer address */
    > int *retlen; /* Address of longword for returned length */
    > } null_items[] = {0,0,0,0};
    >
    >
    > struct
    > {
    > short length; /* Length of buffer in bytes */
    > short code; /* Item code value */
    > void *address; /* Buffer address */
    > int *retlen; /* Address of longword for returned length */
    > }
    > message_select_in_items[4], message_select_in_null_items = {0,0,0,0};
    >
    > struct
    > {
    > short length; /* Length of buffer in bytes */
    > short code; /* Item code value */
    > void *address; /* Buffer address */
    > int *retlen; /* Address of longword for returned length */
    > }
    > message_select_out_items[4], message_select_out_null_items = {0,0,0,0};
    >
    >
    > char DefaultMailfoder[32] = "NEWMAIL";
    > char MessageFrom[32] = "SECUR::SYSTEM";
    >
    > int messages_selected = 0;
    >
    >
    >
    > status = mail$mailfile_begin ( &file_context, null_items, null_items );
    >
    > status = mail$mailfile_open ( &file_context, null_items, null_items );
    >
    > status = mail$mailfile_info_file ( &file_context, mailfile_info_items,
    > null_items );
    >
    > status = mail$message_begin ( &message_context, message_in_items,
    > null_items );
    >
    >
    > message_select_in_items[0].length = sizeof ( DefaultMailfoder );
    > message_select_in_items[0].code = MAIL$_MESSAGE_FOLDER;
    > message_select_in_items[0].address = &DefaultMailfoder;
    > message_select_in_items[0].retlen = 0;
    >
    > message_select_in_items[1] = message_select_in_null_items;
    >
    > message_select_out_items[0].length = sizeof ( messages_selected );
    > message_select_out_items[0].code = MAIL$_MESSAGE_SELECTED;
    > message_select_out_items[0].address = &messages_selected;
    > message_select_out_items[0].retlen = 0;
    >
    > message_select_out_items[1] = message_select_out_null_items;
    >
    > status = mail$message_select ( &message_context,
    > &message_select_in_items, &message_select_out_items );
    >
    > printf ( "Total of %d messages\n", messages_selected );
    >
    > status = mail$message_end ( &message_context, null_items,
    > null_items );
    > status = mail$mailfile_close ( &file_context, null_items, null_items );
    > status = mail$mailfile_end ( &file_context, null_items, null_items );
    >
    > _AXP/SYSTEM> run CHECK_MAIL
    > Total of 2 messages
    > _AXP/SYSTEM>
    >
    > _AXP/SYSTEM> mail
    >
    > You have 2 new messages.
    >
    > MAIL> dir
    >
    >
    > NEWMAIL
    > # From Date Subject
    >
    > 1 SECUR::SYSTEM 9-MAY-2008 Solch ein Mist!
    > 2 SECUR::SYSTEM 9-MAY-2008
    >
    > MAIL>
    >
    > That's ok.
    >
    > But when i use the following item list to select the mail folder and the
    > message from field together:
    >
    >
    > message_select_in_items[0].length = sizeof ( DefaultMailfoder );
    > message_select_in_items[0].code = MAIL$_MESSAGE_FOLDER;
    > message_select_in_items[0].address = &DefaultMailfoder;
    > message_select_in_items[0].retlen = 0;
    >
    > message_select_in_items[1].length = sizeof ( MessageFrom );
    > message_select_in_items[1].code = MAIL$_MESSAGE_FROM_SUBSTRING;
    > message_select_in_items[1].address = &MessageFrom;
    > message_select_in_items[1].retlen = 0;
    >
    > message_select_in_items[2] = message_select_in_null_items;
    >
    > status = mail$message_select ( &message_context,
    > &message_select_in_items, &message_select_out_items );
    >
    >
    > _AXP/SYSTEM> run CHECK_MAIL
    > Total of 0 messages
    > _AXP/SYSTEM>
    >
    >
    > What i do wrong ?
    >
    > Thank you very much for a hint.
    >
    > Klaus
    >




+ Reply to Thread