Group Mailer ~ There is no outgoing Mail message. (-2700)

Hi

I am attempting to use the group mailer function in automator.

I have tried a variety of different work arounds with the same effect.

The process I have created has four stages:

1) Get Specified Address Book Items
2) Group Mailer
3) Get Specified Mail Items
4) Send Outgoing Messages

I have tinkered with the order of stages and with the 'ignore previous results' as suggested on other forums - all to no avail.

The Action reaches Stage 2 (Group Mailer) and then stops with the error message There is no Outgoing Mail Message (-2700).

Can anyone shed any light on this?

Thank you, in advance

Adam

PowerBook G4 ~~ iMac 24inch, Mac OS X (10.4.8), Automator Version: 1.0.4 (87)

Posted on Dec 7, 2006 4:35 PM

Reply
8 replies

Dec 8, 2006 10:43 AM in response to AwolAdam

If you look carefully at the requirements for the Group Mailer action you will notice the following description:

"Requires: An outgoing Mail message with subject, content and any attachments."

If you don't have an outgoing mail message open in Mail then you will get the error.

So to avoid it you either need to manually open an outgoing mail message in Mail or add a "New Mail Message" action to the top of the workflow and an "Add Attachments to Front Message" below that if you need to. I don't believe you need the "Get Specified Mail Items" action either.

Dec 10, 2006 6:43 AM in response to lc55

Hi

Thank you, for your reply.

I perhaps was not clear in the earlier email - I have tried a multiude of different options and set-ups and receive the error message nonetheless.

Have you been able to use the Group Mailer with success? If so, would you mind sharing the Order of Actions (with settings) that you used?

I have tried the suggestions - with having a message open in Mail, and removing the Get Spec. Mail Action but continue to have the -2700 error message.

Thank you , in advance.

Adam

Dec 11, 2006 10:13 PM in response to AwolAdam

Hi AwolAdam,

Sorry for the delay in answering. After your reply I began to do more testing.

I was able to get it to work the other night but it seems to be very unstable. Tonight I used the same workflow and only got it to work once out of about 15 tries. Part of the problem seems to be that you do need to create a new outgoing email message within the workflow to avoid the error message. However, even when the error message does not appear the workflow seemed to be hit or miss in generating the multiple email messages.

I did a search in this forum and found a discussion that suggests that this is not the first time this problem has been noted. http://discussions.apple.com/thread.jspa?messageID=700363&#700363

Action 1: New Mail Message as described in the requirements with the subject and content filled in.
Action 2: Get Specified Finder Items with the files to be attached
Action 3: Add Attachments to Front Message
Action 4: Get Specified Address Book Items with one of my Address Book Groups specified
Action 5: Group Mailer with Greeting selected

I have also begun working on an AppleScript that does essentially the same thing as the Automator Workflow. Right now the details for the AppleScript must be specified in the properties at the top of the script. I am planning to integrate this into an Automator Workflow and gather much of that info from the workflow. Stay tuned!

click here to open this script in your editor <pre style="font-family: 'Monaco', 'Courier New', Courier, monospace; overflow:auto; color: #222; background: #DDD; padding: 0.2em; font-size: 10px; width:400px">property GreetingWanted : true
property theGreeting : "Dear "
property FirstNameOnly : true
property LastNameOnly : false
property FirstLastName : false
property LastFirstName : false
property theSubject : "Group Mailing trials"
property theContent : "This is a trial message."
property FileAttached : true
property theAttachment : "Macintosh HD:Users:djgreggpb:Desktop:1518.jpg"

tell application "Address Book"
set theGroups to name of groups
set theEmailGroup to (choose from list theGroups) as text
set FirstNames to first name of people of group theEmailGroup
set LastNames to last name of people of group theEmailGroup
set EmailAddresses to value of email 1 of people of group theEmailGroup
end tell

tell application "Mail"
activate
repeat with i from 1 to count of EmailAddresses
if GreetingWanted then
if FirstNameOnly then set theCompleteGreeting to theGreeting & item i of FirstNames
if LastNameOnly then set theCompleteGreeting to theGreeting & item i of LastNames
if FirstLastName then set theCompleteGreeting to theGreeting & item i of FirstNames & space & item i of LastNames
if LastFirstName then set theCompleteGreeting to theGreeting & item i of LastNames & space & item i of FirstNames
set theCompleteContent to theCompleteGreeting & "," & return & return & theContent & return
end if
set email to make new outgoing message with properties {subject:theSubject, content:theCompleteContent, sender:"djgregg@telus.net", visible:true}
tell email to make new to recipient with properties {address:item i of EmailAddresses}
if FileAttached then
my MoveToEndOfContent()
tell email to make new attachment with properties {file name:theAttachment as alias}
end if
end repeat
end tell

on MoveToEndOfContent()
tell application "System Events"
tell process "Mail"
keystroke "a" using command down
key code 124 -- right arrow
keystroke return
keystroke return
end tell
end tell
end MoveToEndOfContent</pre>


PowerBook 12" Mac OS X (10.4.8)

Dec 12, 2006 2:49 AM in response to lc55

No problem. Thank you, for your efforts.

I am somewhat comforted that I am not alone... and that it is not [simply] user error; also somewhat impressed with your last post - what with the Script opening in editor.

I really appreciate your efforts - as I am sure many others will as they stumble accross the same difficulties.

I am Staying Tuned!

Cheers

Dec 14, 2006 7:33 PM in response to AwolAdam

The Script opening in the editor is actually an innovation that was developed through Michael Henley, the current top dog in the points race for the Automator forum. I am sure he would be happy to let you have a copy if you send him an email.

I have been able to work out a solution to your problem that uses both Automator, as a front-end for gathering most of the information associated with the previous workflow using the Group Mailer action, and AppleScript to pick up the remaining information and generate the emails.

The Automator workflow consists of the following:
1) New Mail Message with subject, message and account being determined. Show Action When Run is also checked, Show Selected Items radio button selected, and Account, Message and Subject checked in the list;
2) Get Specified Finder Items with Show Action When Run checked;
3) Get Specified Address Book Items with Show Action When Run checked;
4) Run AppleScript

click here to open this script in your editor <pre style="font-family: 'Monaco', 'Courier New', Courier, monospace; overflow:auto; color: #222; background: #DDD; padding: 0.2em; font-size: 10px; width:400px">property GreetingWanted : true
property theGreeting : ""
property GreetingNameOrder : {"First and Last Name", "First Name Only", "Last and First Name", "Last Name Only"}
property theCompleteGreeting : ""
property theSubject : ""
property theContent : ""
property FileAttached : true
property theAttachment : ""

on run {input, parameters}

set theNumberOfInputItems to count of items in input
set CountOfAttachments to (count of items in input) - 2

-- Gather Contact Info
tell application "Address Book"
set theEmailGroup to last item of input
set FirstNames to first name of people of theEmailGroup
set LastNames to last name of people of theEmailGroup
set EmailAddresses to value of email 1 of people of theEmailGroup
end tell

-- Generate emails
tell application "Mail"

-- Email info
set theSubject to subject of first item of input
set theMessage to content of first item of input
set theAttachments to items 2 thru (CountOfAttachments + 1) of input

-- Greeting info
display dialog "Would you like to add a greeting?" buttons {"Yes", "No"} default button 1
if button returned of the result is equal to "Yes" then
set GreetingWanted to true
display dialog "Please enter the opening for the greeting." default answer "Dear "
set theGreeting to text returned of the result
set GreetingName to (choose from list GreetingNameOrder with prompt "Please select the choice of name for the greeting" default items item 1 of GreetingNameOrder) as text
else
set GreetingWanted to false
end if
repeat with i from 1 to count of EmailAddresses
if GreetingWanted then
if (GreetingName = item 1 of GreetingNameOrder) then set theCompleteGreeting to theGreeting & item i of FirstNames & space & item i of LastNames
if (GreetingName = item 2 of GreetingNameOrder) then set theCompleteGreeting to theGreeting & item i of FirstNames
if (GreetingName = item 3 of GreetingNameOrder) then set theCompleteGreeting to theGreeting & item i of LastNames & space & item i of FirstNames
if (GreetingName = item 4 of GreetingNameOrder) then set theCompleteGreeting to theGreeting & item i of LastNames
if GreetingName = false then set theCompleteGreeting to theGreeting
set theCompleteContent to theCompleteGreeting & "," & return & return & theMessage & return
end if

-- Generate email
set email to make new outgoing message with properties {subject:theSubject, content:theCompleteContent, visible:true}
tell email to make new to recipient with properties {address:item i of EmailAddresses}

display dialog "Would you like to add a file attachment(s)?" buttons {"Yes", "No"} default button 1
if button returned of the result is "Yes" then
-- Add attachments
my MoveToEndOfContent()
repeat with i from 1 to CountOfAttachments
tell email to make new attachment with properties {file name:item i of theAttachments}
end repeat
end if
end repeat

end tell
return input

end run

on MoveToEndOfContent()
tell application "System Events"
tell process "Mail"
keystroke "a" using command down
key code 124 -- right arrow
keystroke return
keystroke return
end tell
end tell
end MoveToEndOfContent
</pre>

PowerBook 12" Mac OS X (10.4.8)

Dec 15, 2006 6:32 AM in response to lc55

Wow!

Leaps in front of what I had managed to achieve. Thanks for the Script Tip.

I have set up as suggested. On a short test mail it seems to work great!

It does ask repeatedly if an attachement wants to be added - it there anyway to add a select for all setting? Also how would I set the mail messages to send automatically?

Cheers

A

Dec 15, 2006 10:45 AM in response to AwolAdam

Sorry about that. The one I sent was not the latest version. This one addresses the repeated asking for file attachments and the automatic message sending issues.

Here is the latest version:

click here to open this script in your editor <pre style="font-family: 'Monaco', 'Courier New', Courier, monospace; overflow:auto; color: #222; background: #DDD; padding: 0.2em; font-size: 10px; width:400px">property GreetingWanted : ""
property theGreeting : ""
property GreetingNameOrder : {"First and Last Name", "First Name Only", "Last and First Name", "Last Name Only"}
property theCompleteGreeting : ""
property theSubject : ""
property theContent : ""
property FileAttached : ""
property theAttachment : ""

on run {input, parameters}

set theNumberOfInputItems to count of items in input
set CountOfAttachments to (count of items in input) - 2

-- Gather Contact Info
tell application "Address Book"
set theEmailGroup to last item of input
set FirstNames to first name of people of theEmailGroup
set LastNames to last name of people of theEmailGroup
set EmailAddresses to value of email 1 of people of theEmailGroup
end tell

-- Generate emails
tell application "Mail"

-- Email info
set theSubject to subject of first item of input
set theMessage to content of first item of input
set theAttachments to items 2 thru (CountOfAttachments + 1) of input

-- Greeting info
display dialog "Would you like to add a greeting?" buttons {"Yes", "No"} default button 1
if button returned of the result is equal to "Yes" then
set GreetingWanted to true
display dialog "Please enter the opening for the greeting." default answer "Dear "
set theGreeting to text returned of the result
set GreetingName to (choose from list GreetingNameOrder with prompt "Please select the choice of name for the greeting" default items item 1 of GreetingNameOrder) as text
else
set GreetingWanted to false
end if

-- File Attachment info
display dialog "Would you like to add a file attachment(s)?" buttons {"Yes", "No"} default button 1
if button returned of the result is "Yes" then
set FileAttached to true
else
set FileAttached to false
end if

repeat with i from 1 to count of EmailAddresses
if GreetingWanted then
if (GreetingName = item 1 of GreetingNameOrder) then set theCompleteGreeting to theGreeting & item i of FirstNames & space & item i of LastNames
if (GreetingName = item 2 of GreetingNameOrder) then set theCompleteGreeting to theGreeting & item i of FirstNames
if (GreetingName = item 3 of GreetingNameOrder) then set theCompleteGreeting to theGreeting & item i of LastNames & space & item i of FirstNames
if (GreetingName = item 4 of GreetingNameOrder) then set theCompleteGreeting to theGreeting & item i of LastNames
if GreetingName = false then set theCompleteGreeting to theGreeting
set theCompleteContent to theCompleteGreeting & "," & return & return & theMessage & return
end if

-- Generate email
set email to make new outgoing message with properties {subject:theSubject, content:theCompleteContent, visible:true}
tell email to make new to recipient with properties {address:item i of EmailAddresses}

-- Add attachments
if FileAttached then
my MoveToEndOfContent()
repeat with i from 1 to CountOfAttachments
tell email to make new attachment with properties {file name:item i of theAttachments}
end repeat
end if
send email
end repeat

end tell
return input

end run

on MoveToEndOfContent()
tell application "System Events"
tell process "Mail"
keystroke "a" using command down
key code 124 -- right arrow
keystroke return
keystroke return
end tell
end tell
end MoveToEndOfContent
</pre>

There are a few other refinements that could be added:

1) Avoiding the asking if attachments want to be added by checking whether there were any assigned in the Automator "Get Specified Finder Items" dialog;

2) There is a rather annoying bounce/notification by Automator after the initial "New Mail Message" action. Gathering all the information first and then creating a template with the "New Mail Message" action would avoid this annoyance. Unfortunately, as you know, I am using that action as a quick way to gather the subject, message, and account information.

3) Rename the actions by using a Ctrl click on the action title bar to more clearly indicate what information is being requested in the dialogs.


PowerBook 12" Mac OS X (10.4.8)

Dec 18, 2006 11:23 PM in response to lc55

Hello, Ic55 & AwolAdam.

I hope this message provides some assistance for you. Having to send 64 emals to a customer panel tonight and on an ongoing basis, I luckily found an odd workaround to get Group Mailer to work, with attachments.

There are three broad steps you must follow:
A. Prep
B. Fix Mail
C. Send

Each are explained below in detail.

A. PREP
Create an automator workflow as follows:
  1. New Mail Message >> be sure to complete the subject and message.
  2. Get Specified Finder Items >> be sure to include the item to attach.
  3. Add Attachments to Front Message
  4. Find Groups in Address Book >> set some salient criteria. I'm using "Name is equal to Validation Team".
  5. Group Mailer >> add greeting. I'm using "Dear" and first name only.
  6. Send Ougoing Messages


Now, run the script:
Automator will begin and focus will be turned to mail where you'll find one message with your attachment(s). You'll quickly hear the 'ding' sound and Automator will have an error. Leave Mail as-is and turn your focus to Automator:

  1. Bring Automator to focus.
  2. Clear the error that has popped-up.
  3. Change the workflow by making steps 2 & 3 above steps 1 & 2 and, thus, step 1 becomes 3. Here, this should help:
    1. Get Specified Finder Items >> be sure to include the item to attach.
    2. Add Attachments to Front Message
    3. New Mail Message >> be sure to complete the subject and message.
    4. Find Groups in Address Book >> set some salient criteria. I'm using "Name is equal to Validation Team".
    5. Group Mailer >> add greeting. I'm using "Dear" and first name only.
    6. Send Ougoing Messages


B. FIX MAIL
Save your modified automator script after step 3 and return to Mail
  1. Select the mail message that Automator opened for you.
  2. Carefully delete the attachments. (DO NOT MODIFY ANYTHING ELSE ABOUT THE MESSAGE)
  3. Return your Focus to Automator


C. SEND
Click the Automator RUN button. Automator should automatically change the application focus to Mail. You should see the following happen:
  1. The opened Mail message should have an attachment
  2. Another message should open with nobody on the TO list and NO attachment
  3. A third message should open with a member of your group in the TO list and Mail should display the "Message size: xxx KB" where xxx is the size of your attachment(s).
  4. Sit back and wait patiently. Automator should process slowly through each of the recipients.


OBSERVATIONS and WARNINGS
  • This is very finicky. If you don't follow these steps exactly it will not work. Sometimes I had to bounce (shutdown and retart) mail and automator and try again. Sometimes it didn't work and I'd try again and it'd work. Be patient.
  • Automator seems to throw an exception if you have more than 25 members of an Address Book group. I had to create three separate / smaller groups.
  • TEST! Before you start sending message to people for business, test with two or more safe accounts using a proxy group. My coworkers love me now.
  • The mail message created in section 'A' above should not be modified in any way other than carefully deleting its attachment(s).
  • The automator workfow updated in section 'B' above should not be modified in any way other changing the action flow as described section 'B'. Don't even add an extra line to the body of your message or this won't work.
    Good luck.
    -G4M
    Dual 1.25GHz G4 PowerPC From quiet Cube to Wind tunnel, Cheese grater. :-O

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Group Mailer ~ There is no outgoing Mail message. (-2700)

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.