Mac Mail does not work as I want :)
Mac Mail does not work as I want :)
- Subject: Mac Mail does not work as I want :)
- From: "Fares BELHAOUAS" <email@hidden>
- Date: Thu, 30 Aug 2007 14:43:10 -0400
Hi everyone,
I am trying to automate the creation of a POP account within Mac Mail, I found that the best way to do that is to use Mac Mail AppleScript, I found the "Create New Mail Account.scrpt" sample, I changed it to what I want, the script will follow below.
In my Mac Mail there are no accounts, all is empty, no POP accounts and no SMTP accounts, I execute the script, I don't put a quit at the end, that means my Mac Mail is still running at the end of the script, I see my configuration, all is correct, I can get my emails from the server, all is fine.
The problem comes after to close Mac Mail, I open it again, the configuration is still here, except that the port changed, it is not 995 anymore and SSL is unchecked, the SMTP configuration is bad too.
is there a mistake within my script or is it a Mac Mail bug?
Here is the script I Created:
-- Mail Version 2.1 (752/752.2)
set success to 1
--// COMMUN PARAMETERS
set theUsername to "
email@hidden
"
set thePassword to "My Password"
set theEmailAddresses to "
email@hidden"
set theFullName to "Fares Belhaouas"
--// POP PARAMETERS
set popAccountName to "
email@hidden"
set popHostname to "
pop.gmail.com"
set popPort to 995
set popUsesSSL to true
--// SMTP PARAMETERS
set smtpHostName to "
smtp.gmail.com"
set smtpScheme to "Password"
set smtpPort to 465
set smtpUsesSSL to true
--// POP
tell application "Mail"
try
set thePOPAccount to make new pop account with properties {name:popAccountName, server name:popHostname, user name:theUsername, password:thePassword, full name:theFullName, email addresses:{theEmailAddresses}}
on error
set thePOPAccount to false
end try
if thePOPAccount is not equal to false then
tell thePOPAccount
set server name to popHostname
set full name to theFullName
set email addresses to {theEmailAddresses}
set port to popPort
set uses ssl to popUsesSSL
set authentication to password
set password to thePassword
set user name to theUsername
end tell
end if
end tell
--// SMTP
tell application "Mail"
if thePOPAccount is not equal to false then
set theSMTPAccount to make new smtp server with properties {server name:smtpHostName}
tell theSMTPAccount
set uses ssl to smtpUsesSSL
set port to smtpPort
end tell
if smtpScheme is equal to "Password" then
tell theSMTPAccount
set authentication to password
set password to thePassword
set user name to theUsername
end tell
--
-- theSMTPAccount VALUE CHANGES WHEN WE SETUP A USER NAME
-- IF WE DON'T APPEND ":" AND theUsername THE SCRIPT GENERATES
-- A SCRIPT ERROR
--
set interm to smtpHostName & ":" & theUsername
set theSMTPAccount to smtp server interm
else if smtpScheme is equal to "None" then
tell theSMTPAccount
set authentication to none
end tell
end if
set smtp server of thePOPAccount to theSMTPAccount
else
set success to 0
end if
end tell
if success is equal to 1 then
return "true"
else
return "false"
end if
Thanks for your help,
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden