Code:
set oShell = wscript.CreateObject("Wscript.Shell")
Function main()
dim username, domain, displayname
username = inputbox("Enter your USERNAME (Do not include @oconnorsinternet.com at the end)","O'Connor's Internet Email Setup")
If username = "" Then
wscript.Quit(0)
End If
If username = "Username" Then
while username = "Enter your Email PREFIX or USERNAME"
username = inputbox("Enter your Email PREFIX or username (before the @ sign)","Outlook Express Profile Creator","Username")
If username = "" Then
wscript.Quit(0)
End If
wend
End If
displayname = inputbox("Enter your DISPLAY NAME (The name you want people to see when you E-Mail them","O'Connor's Internet Email Setup")
If displayname = "" Then
wscript.Quit(0)
End If
domain = "Enteryourdomainhere.com"
' displayname = Ltrim(fixme(displayname))
' username = Ltrim(fixme(username))
' domain = fixme2(domain)
'EXAMPLE STRING FOR RTRIM
' RTrim(string)
call placeMailSettings(username, displayname, domain)
msgbox("Outlook Express Configuration Complete, please start Outlook Express and enter your password when prompted.")
End Function
Function regRead(regStr)
regRead = oShell.RegRead(regStr)
End Function
Function regWrite(val1,val2,val3)
oShell.RegWrite val1,val2,val3
End Function
Function regDelete(regStr)
call oShell.RegDelete(regStr)
End Function
'Function fixme(strValue)
' dim userEntry
' userEntry = split(strValue, "@")
' fixme = userEntry(0)
'End Function
'Function fixme2(strValue2)
' dim userEntryd
' userEntryd = split(strValue2, "@")
' fixme2 = userEntryd(0)
'End Function
'EXAMPLE STRING FOR SPLIT
' Split(expression[,delimiter])
'----------------------------------------------------------------------------------------
' Place new settings for Mail
'----------------------------------------------------------------------------------------
Function placeMailSettings(theUsername, thedisplayname, theDomain)
On Error Resume Next
dim newAccountNum, numKeyStr
dim username, displayname, domain
newAccountNum = regRead("HKCU\Software\Microsoft\Internet Account Manager\Account Name")
If newAccountNum = "" Then
newAccountNum = "00000001"
ElseIf newAccountNum < 9 Then
newAccountNum = "0000000" & newAccountNum
Else
newAccountNum = "000000" & newAccountNum
End If
numKeyStr = "HKCU\Software\Microsoft\Internet Account Manager\Accounts\" & newAccountNum & ""
call regWrite(numKeyStr, newAccountNum, "REG_SZ")
username = theUsername
displayname = thedisplayname
domain = theDomain
'Add Account Name
accName = username & "@" & domain
accNameStr = "HKCUSoftwareMicrosoftInternet Account ManagerAccounts" & newAccountNum & "Account Name"
call regWrite(accNameStr, accName, "REG_SZ")
'Add Connection Type
conType = "3"
conTypeStr = "HKCUSoftwareMicrosoftInternet Account ManagerAccounts" & newAccountNum & "Connection Type"
call regWrite(conTypeStr, conType, "REG_DWORD")
'Delete Connection Id
conId = "HKCUSoftwareMicrosoftInternet Account ManagerAccounts" & newAccountNum & "ConnectionId"
call regDelete(conId)
'Delete Account Id
accId = "HKCUSoftwareMicrosoftInternet Account ManagerAccounts" & newAccountNum & "Account ID"
call regDelete(accId)
'Delete IMAP Server
imapSvr = "HKCUSoftwareMicrosoftInternet Account ManagerAccounts" & newAccountNum & "IMAP Server"
call regDelete(imapSvr)
'Delete HTTP Mail Server
httpSvr = "HKCUSoftwareMicrosoftInternet Account ManagerAccounts" & newAccountNum & "HTTPMail Server"
call regDelete(httpSvr)
'Set POP3 Server
pop3svr = "mail." & domain
pop3svrStr = "HKCUSoftwareMicrosoftInternet Account ManagerAccounts" & newAccountNum & "POP3 Server"
call regWrite(pop3svrStr, pop3svr, "REG_SZ")
'Set POP3 Username
pop3usr = username & "@" & domain
pop3usrStr = "HKCUSoftwareMicrosoftInternet Account ManagerAccounts" & newAccountNum & "POP3 User Name"
call regWrite(pop3usrStr, pop3usr, "REG_SZ")
'Delete POP3 Password 2
popPwdStr = "HKCUSoftwareMicrosoftInternet Account ManagerAccounts" & newAccountNum & "POP3 Password2"
call regDelete(popPwdStr)
'Set POP3 Use Sicily
useSicily = "0"
useSicilyStr = "HKCUSoftwareMicrosoftInternet Account ManagerAccounts" & newAccountNum & "POP3 Use Sicily"
call regWrite(useSicilyStr, useSicily, "REG_DWORD")
'Set POP3 Prompt for Pw
var promptPw = "1"
var promptPwStr = "HKCUSoftwareMicrosoftInternet Account ManagerAccounts" & newAccountNum & "POP3 Prompt for Password"
call regWrite(promptPwStr, promptPw, "REG_DWORD")
'Set SMTP Server
smtpSvr = "mail." & domain
smtpSvrStr = "HKCUSoftwareMicrosoftInternet Account ManagerAccounts" & newAccountNum & "SMTP Server"
call regWrite(smtpSvrStr, smtpSvr, "REG_SZ")
'Set SMTP Display name
smtpDisp = displayname
smtpSvrStr = "HKCUSoftwareMicrosoftInternet Account ManagerAccounts" & newAccountNum & "SMTP Display Name"
call regWrite(smtpSvrStr, smtpDisp, "REG_SZ")
'Set SMTP E-mail address
smtpEmail = username & "@" & domain
smtpEmailStr = "HKCUSoftwareMicrosoftInternet Account ManagerAccounts" & newAccountNum & "SMTP Email Address"
call regWrite(smtpEmailStr, smtpEmail, "REG_SZ")
'Set SMTP Use Sicily
smtpUseSicily = "2"
smtpUseSicilyStr = "HKCUSoftwareMicrosoftInternet Account ManagerAccounts" & newAccountNum & "SMTP Use Sicily"
call regWrite(smtpUseSicilyStr, smtpUseSicily, "REG_DWORD")
'Set New Account to default
defAccStr = "HKCUSoftwareMicrosoftInternet Account ManagerDefault Mail Account"
call regWrite(defAccStr, newAccountNum, "REG_SZ")
'Increment future account number
futAccNum = newAccountNum + 1
futAccNumStr = "HKCUSoftwareMicrosoftInternet Account ManagerAccount Name"
call regWrite(futAccNumStr, futAccNum, "REG_DWORD")
msgbox("POP3 Server Set to: " & pop3svr & chr(10) & "SMTP Server Set to: " & smtpSvr)
End Function
call main()
Bookmarks