Adding an email address to my account-preferences

Hi,

Mail is my mail-program.
I own a domain funske.com and I use this for all my mail.
Everyone gets his own email address, for example MacScripter@funske.com.
When I want to reply to an email, or sent a new email, I want the sender to be xxxx@funske.com.
And instead of xxxx it should have the name of the company I’m sending to.
This works fine. Only I have to add the new sender email address to my account-preferences and save it, before I can use it.
I’m looking for a script to add the new sender address to my account-preferences and save this, so I can sent an email.
When I try this:

tell application "Mail" to set allEmailAddresses to email addresses of account "funske.com"
choose from list allEmailAddresses with title "Choose the Mail account to use..."
set theEmailAddress to result as string

I get all my email addresses that I can use with the account funske.com and can choose the one I want to use.

So it should be something like this:

tell application "Mail" to add "MacScripter@funske.com" to email addresses of account "funske.com"

Instead of “MacScripter@funske.com” I can use a variable that i can set before.

Does somebody can help me to add an new email address to my account-preferences

Model: iMac
AppleScript: 2.2.3
Browser: Safari 536.26.17
Operating System: Mac OS X (10.8)

Hi,

the email addresses are just a list of strings, so get the list, append an address and write the list back


tell application "Mail"
	set funskeEmailAddresses to email addresses of account "funske.com"
	set end of funskeEmailAddresses to "MacScripter@funske.com"
	set email addresses of account "funske.com" to funskeEmailAddresses
end tell

Thank you very much Stefan!!! :smiley:
I’ve tried all kinds of things, but that it would be so simple…
I’m ashamed…

But very happy!!! Thanks again.

Now I just have to make the script so that I can start it, type in the name of the company and write the email and just sent it!!