home *** CD-ROM | disk | FTP | other *** search
- global EmailPref
-
- on GetUserEmailPref InfoToLocate
- if (InfoToLocate > 2) or (InfoToLocate < 1) then
- return EMPTY
- exit
- end if
- try = 1
- if voidp(EmailPref) then
- EmailPref = [EMPTY, EMPTY]
- else
- return getAt(EmailPref, InfoToLocate)
- end if
- default = dosReadReg("HKEY_LOCAL_MACHINE", "Software\Clients\Mail", EMPTY)
- if default contains "Outlook Express" then
- Priority = [0, 1, 2, 3, 4, 5, 6, 7, 10]
- else
- if default contains "Outlook" then
- Priority = [1, 0, 2, 3, 4, 5, 6, 7, 10]
- else
- if default contains "Netscape" then
- Priority = [2, 3, 0, 1, 4, 5, 6, 7, 10]
- else
- if default contains "Eudora" then
- Priority = [5, 0, 1, 2, 3, 4, 6, 7, 10]
- else
- if default contains "Pegasus" then
- Priority = [6, 0, 1, 2, 3, 4, 5, 7, 10]
- else
- if default contains "Becky" then
- Priority = [7, 0, 1, 2, 3, 4, 5, 6, 10]
- else
- Priority = [0, 1, 2, 3, 4, 5, 6, 7, 10]
- end if
- end if
- end if
- end if
- end if
- end if
- repeat while getAt(EmailPref, InfoToLocate) = EMPTY
- case getAt(Priority, try) of
- 0:
- EmailPref = CheckOutlook(1)
- 1:
- EmailPref = CheckOutlook(2)
- 2:
- EmailPref = CheckNetscape(4)
- 3:
- EmailPref = CheckNetscape(3)
- 4:
- EmailPref = CheckInternetMail()
- 5:
- EmailPref = CheckEudoraLight()
- 6:
- EmailPref = CheckPegasus()
- 7:
- EmailPref = CheckBecky()
- 10:
- exit repeat
- otherwise:
- end case
- try = try + 1
- end repeat
- return getAt(EmailPref, InfoToLocate)
- end
-
- on CheckNetscape Ver
- Pref = [EMPTY, EMPTY]
- if Ver = 3 then
- email = dosReadReg("HKEY_CURRENT_USER", "Software\Netscape\Netscape Navigator\User", "User_Addr")
- name = dosReadReg("HKEY_CURRENT_USER", "Software\Netscape\Netscape Navigator\User", "User_Name")
- smtp = dosReadReg("HKEY_CURRENT_USER", "Software\Netscape\Netscape Navigator\Services", "SMTP_Server")
- if email <> EMPTY then
- if name <> EMPTY then
- setAt(Pref, 1, name & " <" & email & ">")
- else
- setAt(Pref, 1, email)
- end if
- end if
- if smtp <> EMPTY then
- setAt(Pref, 2, smtp)
- end if
- else
- if Ver = 4 then
- name = EMPTY
- email = EMPTY
- smtp = EMPTY
- the itemDelimiter = "\"
- NetscapePath = dosReadReg("HKEY_CURRENT_USER", "Software\Netscape\Netscape Navigator\Main", "Install Directory")
- CurrentUser = dosReadReg("HKEY_CURRENT_USER", "Software\Netscape\Netscape Navigator\biff", "CurrentUser")
- if (NetscapePath <> EMPTY) and (CurrentUser <> EMPTY) then
- delete char -30002 of NetscapePath
- if dosIsFileExist(NetscapePath & "\Users\" & CurrentUser & "\prefs.js") then
- PrefFile = new(xtra("FileIO"))
- openFile(PrefFile, NetscapePath & "\Users\" & CurrentUser & "\prefs.js", 1)
- if status(PrefFile) = 0 then
- fLine = readLine(PrefFile)
- the itemDelimiter = QUOTE
- repeat while fLine <> EMPTY
- if fLine contains "mail.identity.username" then
- name = item 4 of fLine
- else
- if fLine contains "mail.identity.useremail" then
- email = item 4 of fLine
- else
- if fLine contains "network.hosts.smtp_server" then
- smtp = item 4 of fLine
- end if
- end if
- end if
- fLine = readLine(PrefFile)
- end repeat
- end if
- closeFile(PrefFile)
- PrefFile = 0
- if email <> EMPTY then
- email = " <" & email & ">"
- end if
- Pref = [name & email, smtp]
- end if
- end if
- end if
- end if
- return Pref
- end
-
- on CheckInternetMail
- Pref = [EMPTY, EMPTY]
- email = dosReadReg("HKEY_CURRENT_USER", "Software\Microsoft\Internet Mail and News\Mail", "Sender Email")
- name = dosReadReg("HKEY_CURRENT_USER", "Software\Microsoft\Internet Mail and News\Mail", "Sender Name")
- smtp = dosReadReg("HKEY_CURRENT_USER", "Software\Microsoft\Internet Mail and News\Mail", "Default SMTP Server")
- if email <> EMPTY then
- if name <> EMPTY then
- setAt(Pref, 1, name & " <" & email & ">")
- else
- setAt(Pref, 1, email)
- end if
- end if
- if smtp <> EMPTY then
- setAt(Pref, 2, smtp)
- end if
- return Pref
- end
-
- on CheckOutlook Ver
- Pref = [EMPTY, EMPTY]
- if Ver = 1 then
- Account = dosReadReg("HKEY_CURRENT_USER", "Software\Microsoft\Internet Account Manager", "Default Mail Account")
- email = dosReadReg("HKEY_CURRENT_USER", "Software\Microsoft\Internet Account Manager\Accounts\" & Account, "SMTP Email Address")
- name = dosReadReg("HKEY_CURRENT_USER", "Software\Microsoft\Internet Account Manager\Accounts\" & Account, "SMTP Display Name")
- smtp = dosReadReg("HKEY_CURRENT_USER", "Software\Microsoft\Internet Account Manager\Accounts\" & Account, "SMTP Server")
- else
- if Ver = 2 then
- Account = dosReadReg("HKEY_CURRENT_USER", "Software\Microsoft\Office\8.0\Outlook\OMI Account Manager", "Default Mail Account")
- email = dosReadReg("HKEY_CURRENT_USER", "Software\Microsoft\Office\8.0\Outlook\OMI Account Manager\Accounts\" & Account, "SMTP Email Address")
- name = dosReadReg("HKEY_CURRENT_USER", "Software\Microsoft\Office\8.0\Outlook\OMI Account Manager\Accounts\" & Account, "SMTP Display Name")
- smtp = dosReadReg("HKEY_CURRENT_USER", "Software\Microsoft\Office\8.0\Outlook\OMI Account Manager\Accounts\" & Account, "SMTP Server")
- end if
- end if
- if email <> EMPTY then
- if name <> EMPTY then
- setAt(Pref, 1, name & " <" & email & ">")
- else
- setAt(Pref, 1, email)
- end if
- end if
- if smtp <> EMPTY then
- setAt(Pref, 2, smtp)
- end if
- return Pref
- end
-
- on CheckEudoraLight
- Pref = [EMPTY, EMPTY]
- EudoraPath = dosReadReg("HKEY_CURRENT_USER", "Software\Qualcomm\Eudora\CommandLine", "Current")
- if EudoraPath = EMPTY then
- return Pref
- exit
- end if
- EudoraPath = word 1 of EudoraPath
- the itemDelimiter = "\"
- delete char -30002 of EudoraPath
- EudoraINI = EudoraPath & "\Eudora.ini"
- name = dosReadINI(EudoraINI, "Settings", "RealName")
- email = dosReadINI(EudoraINI, "Settings", "ReturnAddress")
- smtp = dosReadINI(EudoraINI, "Settings", "SMTPServer")
- if email <> EMPTY then
- if name <> EMPTY then
- setAt(Pref, 1, name & " <" & email & ">")
- else
- setAt(Pref, 1, email)
- end if
- end if
- if smtp <> EMPTY then
- setAt(Pref, 2, smtp)
- end if
- return Pref
- end
-
- on CheckPegasus
- Pref = [EMPTY, EMPTY]
- MailBoxPath = dosReadReg("HKEY_CURRENT_USER", "Software\Pegasus Mail\Mailbox", EMPTY)
- if MailBoxPath = EMPTY then
- MailBoxPath = dosReadReg("HKEY_CURRENT_USER", "Software\Pegasus Mail\BaseDir", EMPTY)
- if MailBoxPath = EMPTY then
- return Pref
- exit
- else
- CFGFile = new(xtra("FileIO"))
- openFile(CFGFile, MailBoxPath & "\Pmail.cfg", 1)
- if status(CFGFile) <> 0 then
- return Pref
- exit
- end if
- MailBoxPath = readLine(CFGFile)
- repeat with i = 1 to the number of chars in MailBoxPath
- if charToNum(char i of MailBoxPath) = 0 then
- MailBoxPath = char 1 to i - 1 of MailBoxPath
- end if
- end repeat
- closeFile(CFGFile)
- CFGFile = 0
- if dosIsFileExist(MailBoxPath & "\Pmail.ini") then
- the itemDelimiter = "\"
- delete char -30002 of MailBoxPath
- CFGFile = new(xtra("FileIO"))
- openFile(CFGFile, MailBoxPath & "\Pmail.usr", 1)
- if status(CFGFile) <> 0 then
- return Pref
- exit
- end if
- the itemDelimiter = ";"
- fLine = " "
- repeat while fLine <> EMPTY
- fLine = readLine(CFGFile)
- if char 1 of fLine = numToChar(10) then
- delete char 1 of fLine
- end if
- if item 1 of fLine = "A" then
- MailBoxPath = MailBoxPath & "\" & item 2 of fLine
- exit repeat
- end if
- end repeat
- closeFile(CFGFile)
- CFGFile = 0
- end if
- end if
- end if
- MailBoxINI = MailBoxPath & "\Pmail.ini"
- name = dosReadINI(MailBoxINI, "General", "Personal name")
- email = dosReadINI(MailBoxINI, "Pegasus Mail for Windows - built-in TCP/IP Mail", "Alternative From: field for message")
- if email = EMPTY then
- email = dosReadINI(MailBoxINI, "General", "Default reply-to address")
- end if
- smtp = dosReadINI(MailBoxINI, "Pegasus Mail for Windows - built-in TCP/IP Mail", "SMTP relay host for outgoing mail")
- if email <> EMPTY then
- if name <> EMPTY then
- setAt(Pref, 1, name & " <" & email & ">")
- else
- setAt(Pref, 1, email)
- end if
- end if
- if smtp <> EMPTY then
- setAt(Pref, 2, smtp)
- end if
- return Pref
- end
-
- on CheckBecky
- Pref = [EMPTY, EMPTY]
- Account = dosReadReg("HKEY_CURRENT_USER", "Software\RIMArts\Rebecca\Settings", "DefUser")
- email = dosReadReg("HKEY_CURRENT_USER", "Software\RIMArts\Rebecca\Users\" & Account, "Address")
- name = dosReadReg("HKEY_CURRENT_USER", "Software\RIMArts\Rebecca\Users\" & Account, "Name")
- smtp = dosReadReg("HKEY_CURRENT_USER", "Software\RIMArts\Rebecca\Users\" & Account, "SMTP")
- if email <> EMPTY then
- if name <> EMPTY then
- setAt(Pref, 1, name & " <" & email & ">")
- else
- setAt(Pref, 1, email)
- end if
- end if
- if smtp <> EMPTY then
- setAt(Pref, 2, smtp)
- end if
- return Pref
- end
-