summaryrefslogtreecommitdiff
path: root/_test/cases/inc/mail_send.php
blob: e41c501fe0d0505a229c37d8386df768f26b3c47 (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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
<?php
require_once DOKU_INC.'inc/mail.php';

class mail_send extends UnitTestCase {

    /**
     * These tests will try to send a bunch of mails to dokuwiki1@spam.la and
     * dokuwiki2@spam.la - check the correctness at http://spam.la
     */
    function test1(){
        $addr = array(
                'dokuwiki1@spam.la',
                'dokuwiki2@spam.la',
                'Test User <dokuwiki1@spam.la>',
                'dokuwiki1@spam.la, dokuwiki2@spam.la',
                'Test User 1 <dokuwiki1@spam.la>, Test User 2 <dokuwiki2@spam.la>'
                );


        $run = 0;
        foreach($addr as $ad){
            $run++;
            $data = array(
                        'to'      => $ad,
                        'subject' => 'mailtest 1-'.$run,
                        'body'    => "Mailtest run 1-$run using to: $ad from:",
                         );
            $this->assertTrue((bool) _mail_send_action($data));

            $data = array(
                        'to'      => $ad,
                        'from'    => 'dokuwiki1@spam.la',
                        'subject' => 'mailtest 2-'.$run,
                        'body'    => "Mailtest run 2-$run using to: $ad from: dokuwiki1@spam.la",
                         );
            $this->assertTrue((bool) _mail_send_action($data));

            $data = array(
                        'to'      => $ad,
                        'from'    => '"Foo Bar" <dokuwiki@spam.la>',
                        'subject' => 'mailtest 3-'.$run,
                        'body'    => "Mailtest run 3-$run using to: $ad from: \"Foo Bar\" <dokuwiki@spam.la>",
                         );
            $this->assertTrue((bool) _mail_send_action($data));
        }
    }

}
//Setup VIM: ex: et ts=4 :