• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Mail fields wont update
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Mail fields wont update


  • Subject: Mail fields wont update
  • From: David Siberry <email@hidden>
  • Date: Tue, 7 Jun 2005 15:00:56 +0100

Hi, I am writing an AppleScript to create an e-mail account and if the
account already exists, repopulate the accound with the correct data.

However I have found that I can create a new account fine, but if i
change some of the fields and populate them with erroneous data my
script wont update.
My debugger ran out of its 30 trial and i cant seem to find out why my
script wont work.

Here it is:

on setupSMTP()
	tell application "Mail"

		--SMTP Constants
		set cSMTPName to "DSMTP"
		set cSMTPAccType to "smtp"
		set cSMTPEnabled to 1
		set cSMTPUserName to "smtpUserName"
		set cSMTPPort to 24
		set cSMTPServerName to "smtp.mail.com"
		set cSMTPUsesSSL to 1
		set cSMTPAuth to "password"
		set cSMTPPassword to "pass"
		set createIT to true

		set p1 to get every smtp server whose server name is equal to cSMTPServerName
		repeat with x in p1

			set properties of x to {name:cSMTPName, account type:cSMTPAccType,
enabled:cSMTPEnabled, user name:cSMTPUserName, port:cSMTPPort, server
name:cSMTPServerName, uses ssl:cSMTPUsesSSL, authentication:cSMTPAuth,
password:cSMTPPassword}
			set createIT to false

		end repeat

		if (createIT is equal to true) then

			set s to make new smtp server with properties {name:cSMTPName,
account type:cSMTPAccType, enabled:cSMTPEnabled, user
name:cSMTPUserName, port:cSMTPPort, server name:cSMTPServerName, uses
ssl:cSMTPUsesSSL, authentication:cSMTPAuth, password:cSMTPPassword}

			set properties of s to {name:cSMTPName, account type:cSMTPAccType,
enabled:cSMTPEnabled, user name:cSMTPUserName, port:cSMTPPort, server
name:cSMTPServerName, uses ssl:cSMTPUsesSSL, authentication:cSMTPAuth,
password:cSMTPPassword}
		end if

	end tell
end setupSMTP

on setupEmail(theAcc)
	tell application "Mail"

		--Pop constants

		set popUN to "David Account"
		set popFullName to "David Siberry"
		set popServerName to "pop.mail.com"
		set popPassword to "password"
		set popEmailAddresses to "email@hidden"
		set popIncludeWhenGettingNewMail to 1
		set popPort to 115
		set popEnabled to 1
		set popUsesSSL to 0
		set popDelayedMsgDelInt to 5
		set popDeleteMailOnServer to 1
		set popDeleteMsgWhenMovedFromInbox to 1
		set popAuthentication to "password"
		set popName to "David"

		set user name of theAcc to popUN
		set full name of theAcc to popFullName
		set server name of theAcc to popServerName
		set password of theAcc to popPassword
		set email addresses of theAcc to popEmailAddresses
		set include when getting new mail of theAcc to popIncludeWhenGettingNewMail
		set port of theAcc to popPort
		set enabled of theAcc to popEnabled
		set uses ssl of theAcc to popUsesSSL
		set delayed message deletion interval of theAcc to popDelayedMsgDelInt
		set delete mail on server of theAcc to popDeleteMailOnServer
		set delete messages when moved from inbox of theAcc to
popDeleteMsgWhenMovedFromInbox
		set authentication of theAcc to popAuthentication
		set name of theAcc to popName
		set found to 0
		my setupSMTP()

	end tell
end setupEmail

on closeDialogue()
	tell application "System Events"
		tell application process "Mail"
			tell window "Welcome to Mail"
				click button "Quit"
			end tell
			quit application
		end tell
	end tell
end closeDialogue


tell application "Mail"

	set found to 0

	-- Searches for existing e-mail account whose name is
	-- equal to the string declared
	set p to get every pop account whose name is "David"
	repeat with x in p

		-- if account found, then account is edited and
		-- values are set to the required defaulted values
		my setupEmail(x)
		set found to 1

	end repeat

	if (found is equal to 0) then

		-- Create new POP account
		set m to make pop account with properties {name:"David", user
name:"David Account", full name:"David Siberry", server
name:"pop.gmail.com", password:"password", email
addresses:"email@hidden", include when getting new mail:1,
port:115, enabled:1, uses ssl:1, authentication:password, delayed
message deletion interval:5, delete mail on server:1, delete messages
when moved from inbox:1}

		set p to get every pop account whose name is "David"
		repeat with x in p

			-- if account found, then account is edited and
			-- values are set to the required defaulted values
			my setupEmail(x)

		end repeat

	end if

	try
		my closeDialogue()
	end try

	try
		quit application
	end try

end tell

Can anyone help me fix this problem?

Cheers

David Siberry
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Prev by Date: Re: Shit - it's all true
  • Next by Date: Re: Shit - it's all true
  • Previous by thread: Address Book & SMS & AppleScript
  • Next by thread: Quark 6.5 Production Scripting Question
  • Index(es):
    • Date
    • Thread