2013/02/26

e-Mail function's test

This is a sample program of e-mail function. Please be prepared to png file separately to make the attachment.
//------------------------------------------------
/* eMailSend() test
//------------------------------------------------

dim str fileList(256):// Inside () is the maximum number of files that can be handled
int cnt
// Test with changing here png->jpeg
cnt=files(fileList,"","bas",YES,FILES_FILE)
if isLocalizeJapan() then {
 print "該当ファイル数=";cnt
} else {
 print "Corresponding file number=";cnt
}
int i
for i=0 to cnt-1
 print i;":";fileList(i)
next

// (1)no attachment
if isLocalizeJapan() then {
 print "(1)添付なし"
 emailSend("件名1","本文1")
} else {
 print "(1)no attachment"
 emailSend("subject1","body1")
}
//hitKey()
// (2)attach each file
if isLocalizeJapan() then {
 print "(2)そのまま添付"
 emailSend("件名2","本文2(添付付き)",fileList,3)
} else {
 print "(2)attach each file"
 emailSend("subject2","body2(with attachment)",fileList,3)
}
//hitKey()
// (3)attach with zip archive
if isLocalizeJapan() then {
 print "(3)zip圧縮添付"
 emailSend("件名3","本文3(zip添付付き)",fileList,10,"testzip.zip")
} else {
 print "(3)attach with zip archive"
 emailSend("subject3","body3(zip archive)",fileList,10,"testzip.zip")
}

if isLocalizeJapan() then {
 print "全送信終了"
} else {
 print "All send finish."
}

//------------------------------------------------
end
//------------------------------------------------
func hitKey()
 str exit$
 if isLocalizeJapan() then {
  exit$="次へ"
 } else {
  exit$="To Next"
 }
 setFunctionKey(0,exit$,'!')
 displayFunctionKey(YES,0,0)
 while inkey()=0
 endwhile
 cls()
 displayFunctionKey(NO,0,0)
endfunc

Zip archive file : XBtests.zip

No comments:

Post a Comment