summaryrefslogtreecommitdiff
path: root/test/create_mails.sh
blob: 15da45c104271dacb22dea67342c50dc2f0604ad (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
50
51
52
53
54
55
56
#!/bin/bash

# Set this to the local user who will recieve the test emails.
# It's recommended that this user is a simple non-login user
# specifically for email testing.
#
UNAME=kbstest

# Check the environment
#
if [ ! -x ../src/kbs ] ; then
    echo kbs not built!
    exit
fi

if [ "`netstat -a | egrep LISTEN | egrep smtp`" = "" ] ; then
    echo No SMTP server
    exit
fi

function email()
{
    cat << ENDMAIL > /dev/tcp/localhost/25
HELO localhost
MAIL FROM: $1
RCPT TO: $UNAME
DATA
To: $2
Subject: $3
Content-Type: $4

Test $5

.
QUIT
ENDMAIL

    echo Created email from $1 to $2
}

# Send the test emails
#
email "trusted@google.com" "uname@hostname" "" "text/plain" 1
email "bad_user@microsoft.com" "uname@hostname" "good" "text/plain" 2
email "trusted@google.com" "uname@hostname" "good" "text/plain" 3
email "trusted@google.com" "uname@hostname" "bad" "text/plain" 4
email "good_user@freebsd.org" "uname@hostname" "bad" "text/plain" 5
email "good_user@freebsd.org" "uname@hostname" "bad" "text/html" 6
email "good_user@google.com" "uname@hostname" "good" "text/plain" 7
email "bad_user@google.com" "uname@hostname" "good" "text/html" 8
email "bad_user@google.com" "uname@hostname" "bad" "text/plain" 9
email "bad_user@google.com" "uname@hostname" "bad" "text/html" 10
email "bad_user@google.com" "uname@hostname" "b_a_d" "text/plain" 11
email "bad_user_uname@google.com" "baduname@hostname" "good" "text/plain" 12
email "bad_user_hname@google.com" "uname@badhostname" "good" "text/plain" 13
email "bad_user2@google.com" "uname@hostname" "good" "text/plain" 14