summaryrefslogtreecommitdiff
path: root/tests/test_mailto.c
blob: 3c54e27ba17b584e7dd5904588ba23d5ac9d1555 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#include <stdio.h>
#include <stdlib.h>

#include <dapi/comm.h>
#include <dapi/calls.h>

int main()
    {
    int ok;
    stringarr attachments;
    char* attachments_data[] = { "/tmp/mailtotest.txt" };
    DapiConnection* conn = dapi_connectAndInit();
    if( conn == NULL )
        {
        fprintf( stderr, "Cannot connect!\n" );
        return 1;
        }
    if(system( "touch /tmp/mailtotest.txt" ))
        return perror("system()"), 1;
    attachments.count = 1;
    attachments.data = attachments_data;
    ok = dapi_MailTo_Window( conn, "Test mail", "Hi,\n\nthis is a test mail.\n",
        "l.lunak@suse.cz, l.lunak@kde.org", NULL, "portland@lists.freedesktop.org", attachments,
        0 ); /* no mainwindow */
    printf( "Result: %s\n", ok == 1 ? "Ok" : "Failed" );
    dapi_close( conn );
    return 0;
    }