A reader going by the name birdmanjrmd asked me to create a solution that forwards all the messages in a folder to another person. birdmanjrmd asks that the solution
- Prompt him for text to send with each message. The script will include the text he enters in the body of each item it forwards.
- Prompt him for a folder to move processed items to. The script will move each item it processes to this folder.
birdman didn’t specify how the script should get the address of the person to forward the messages to. I decided to handle that by prompting for the address. Here then is the logic the script uses
- Prompt for the address of the person to forward the messages to. If the user doesn’t enter an address, then stop processing.
- Prompt for the text to include in the body of each forwarded item. If the user doesn’t enter any text, then stop processing.
- Prompt for the folder to move processed items to. If the user doesn’t select a folder, then stop processing.
- Process all the items in the currently selected folder. For each item, create an email, attach the current item to it, address the message to the address the user entered in step #1, set the message’s body to the text entered in step #2, send the message, then move the item to the folder selected in step #3.