simple script to setup IMAP/SMTP Mail account

I am trying to help a school out by creating a script which creates a new IMAP/SMTP account for a user.
I started by working from the sample scripts that came with my OS X Leopard installation…but it appears that the SMTP portion of the script does not work properly.

I am also unable to find in formation on this board from someone who has scripted Mail account setups before.

Can someone please provide some assistance?

I had the same problem with SMTP, and a solution would be wonderful!

Looking around this forum, and Google, it appears this question has been asked numerous times and had never been answered.

How disheartening.