Friend, your post is incredibly vague, and you’ve yet to fill in the details. Nobody here can write you a script that does exactly what you want without details. If you’re looking for that, head over to the Gnome mail boards. You have the freedom to do so because it’s open source. We’re just people here trying to help.