summaryrefslogtreecommitdiff
path: root/tests/test_mailto.c
blob: 70cc4c4b3e1ad9160d7362a0693961e32dcac4d6 (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
29
30
31
32
#include <stdio.h>
#include <stdlib.h>

#include "comm.h"
#include "calls.h"

int main()
    {
    int ok;
    stringarr attachments;
    char* attachments_data[] = { "/tmp/mailtotest.txt" };
    DapiConnection* conn = dapi_connect();
    if( conn == NULL )
        {
        fprintf( stderr, "Cannot connect!\n" );
        return 1;
        }
    if( !dapi_Init( conn ))
        {
        fprintf( stderr, "Initialization failed!\n" );
        return 2;
        }
    system( "touch /tmp/mailtotest.txt" );
    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;
    }