Re: Change mail.app username, account name and email address
Re: Change mail.app username, account name and email address
- Subject: Re: Change mail.app username, account name and email address
- From: Philip Aker <email@hidden>
- Date: Mon, 20 May 2002 03:42:11 -0700
(*
On Friday, May 17, 2002, at 03:52 PM, Gabe Benveniste wrote:
is it possible to change the username, account name and email
address of an account in mail.app with applescript?
Hi,
I originally wrote to Gabe suggesting to use Mail's preference
file to do this. I see that it would be possible but am having a
little trouble parsing the returned portion to get the specific
details. This is because they are sub-portions of the 'read
defaults' shell command. Anyone know how to do that easily?
Secondly, here is a script which _almost_ creates a new mail
account. The "SMTPIdentifier" section does not seem to take and
the "Password" item (as seen in Mail's preferences) does not
seem to be in the .plist file". Anyone know how to deal with
these?
*)
on DoAccountPortion()
set daccs to (do shell script "defaults read com.apple.mail
'MailAccounts'")
set head to (items 1 thru -3 of daccs) as string
set tail to (items -2 thru -1 of daccs) as string
set newguy to ",
{
AccountName = joe;
AccountPath = \"~/Library/Mail/POP:email@hidden\";
AccountType = POPAccount;
BigMessageWarningSize = \"-1\";
DeleteMessagesOnServer = NO;
EmailAddresses = (\"email@hidden\");
FullUserName = \"Joe\";
HideAccountInMailboxesDrawer = YES;
Hostname = mail.joe.com;
InboxPath = \"~/Library/Mail/Mailboxes/INBOX.mbox\";
SMTPIdentifier = \"smtp.joe.com:joe\";
Username = joe;
}"
set newdacc to head & newguy & tail
end DoAccountPortion
on DoDeliveryPortion()
set daccs to (do shell script "defaults read com.apple.mail
'DeliveryAccounts'")
set head to (items 1 thru -3 of daccs) as string
set tail to (items -2 thru -1 of daccs) as string
set newguy to ",
{
AccountType = SMTPAccount;
Hostname = mail.joe.com;
ShouldUseAuthentication = NO;
UserName = joe;
}"
set newdacc to head & newguy & tail
end DoDeliveryPortion
on run
set t to (time of (current date)) as string
set mailPListPath to "~/Library/Preferences/com.apple.mail.plist"
set mailPListBackup to "~/Desktop/com.apple.mail.plist" & "." & t
do shell script "cat " & mailPListPath & " > " & mailPListBackup
set d to DoDeliveryPortion()
do shell script "defaults write com.apple.mail
DeliveryAccounts '" & d & "'"
set m to DoAccountPortion()
do shell script "defaults write com.apple.mail
MailAccounts '" & m & "'"
do shell script "cd ~/Library/Mail;mkdir 'POP:email@hidden'"
end run
--Philip Aker
--
http://www.aker.ca
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.