on 22/02/2005 06:30, Day Jimenez at [EMAIL PROTECTED] wrote:

> is there any way to set up two smtp servers in entourage 2004 so as to
> switch between them depending on what location you are connected to,
> i.e., work or home?
> 
> my isp at home, bellsouth does not allow relaying
> and therefore i must switch smtp servers when i am at home.

If you create an AppleScript with the following code and place it in
Entourage's Script Menu folder you can use it to swap between smtp servers.
Enter your ISP details into the serverList at the beginning of the script.
The are also a couple of lines which have wrapped to the next line that need
unwrapping.

--- Cut below ---
property serverList : {�
    {name:"ISP1", address:"smtp.isp1.com"}, �
    {name:"ISP2", address:"smtp.isp2.com"}}

on run
    -- get current SMTP server
    tell application "Microsoft Entourage"
        repeat with thePOPAccount in every POP account
            if not SMTP requires authentication of thePOPAccount then
                set currentServer to SMTP server of thePOPAccount
                exit repeat
            end if
        end repeat
    end tell
    
    -- set up list of choices with current already selected
    set extraServer to ""
    set defaultServer to {}
    set listChoice to {}
    repeat with theServer in serverList
        if currentServer is address of theServer then
            set defaultServer to {name of theServer}
        end if
        set listChoice to listChoice & name of theServer
    end repeat
    if defaultServer = {} then -- current server is not in list
        set extraServer to currentServer
        set defaultServer to currentServer
        set listChoice to listChoice & extraServer & "Other"
    else
        set listChoice to listChoice & "Other"
    end if
    
    -- ask user to choose
    set theChoice to choose from list listChoice default items defaultServer
with prompt "Which SMTP Server?"
    if theChoice is false then return -- user cancelled
    
    -- process choice
    set theServerAddress to ""
    if theChoice = {"Other"} then
        set theReply to display dialog "What is the SMTP server?" default
answer ""
        set theServerAddress to text returned of theReply
    else -- find choice in list
        repeat with oneServer in serverList
            if name of oneServer = item 1 of theChoice then
                set theServerAddress to address of oneServer
                exit repeat
            end if
        end repeat
        if theServerAddress = "" then -- choice was extraServer
            set theServerAddress to item 1 of theChoice
        end if
    end if
    
    -- set the SMTP server
    if theServerAddress � "" then
        tell application "Microsoft Entourage"
            repeat with thePOPAccount in every POP account
                if not SMTP requires authentication of thePOPAccount then
                    set SMTP server of thePOPAccount to theServerAddress
                end if
            end repeat
        end tell
    end if
end run
--- cut above ---

-- 
Matthew Smith


--
To unsubscribe:
<mailto:[EMAIL PROTECTED]>
archives:
<http://www.mail-archive.com/entourage-talk%40lists.letterrip.com/>
old-archive:
<http://www.mail-archive.com/entourage-talk%40lists.boingo.com/>

Reply via email to