Send mail using FileMaker Pro

Here’s what I came up with to solve the issue of not having an outbox to be able to drag messages to from the drafts folder (again, I liked the way Entourage was set up whereby I could script items to be created in the drafts folder, review them, and when ready, drag all of them to the outbox. This solution works around the fact that there is no Outbox folder in Outlook (even when the Outbox progress icon is visible when sending mail, you can’t drag and drop any emails onto it)):

This first script assumes that you have created a folder named “_Outbox” the the “On my computer” email folders list. Outlook won’t let you create a folder named “Outbox”, and naming the folder starting with an underscore puts it at the top of the folder list for easy access."

tell application “Microsoft Outlook”
–set theAccount to exchange account “nameofaccount”
–set theAccount to pop account “name of account”
–settheAccount to imap account “nameofaccount”
tell folder “_Outbox” of theAccount
set tmp to make new outgoing message with properties {subject:“This is the subject line”, content:"This is the body of the message. ", account:theAccount}
end tell
make new to recipient at tmp with properties {email address:{address:“to-name@domain.com”}}
make new cc recipient at tmp with properties {email address:{address:“cc-name@domain.com”}}
make new bcc recipient at tmp with properties {email address:{address:“bcc-name@domain.com”}}
make new attachment at tmp with properties {file:“Macintosh HD:Users:yourname:desktop:document.pdf”} – or {file:choose file}
end tell

Modify this to suit your needs. Once you have some drafts in the _Outbox folder and are ready to send them, run this second script:

property countMessages : “”
tell application “Microsoft Outlook”
set countMessages to count mail folder “_Outbox”'s outgoing messages
tell mail folder “_Outbox”
repeat with i from 1 to countMessages
send object 1
–only need to send object 1 because every message that is sent is deleted from this folder
end repeat
end tell
end tell

You can put this second script in the Outlook script menu (name it something like “_send_outbox” so it appears at the top of the list, and/or assign it a keyboard shortcut using the keyboard preference pane.

-Bob

Sorry, my first post didn’t have the FMP part of it. Below is they way my first post should have read:

As you would be aware if you are reading this post, the send mail command in FileMaker Pro does not work with Outlook 2011 for the Mac (as of version 14.0.1). Here’s the workaround that I came up with:

The Filemaker fields referenced below are global fields, meant to temporarily hold the indicated information. You can’t access related fields as far as I know, so all of the fields have to be in the current record.

As you also may know, Outlook 2011 does not have an outbox folder. There is an Outbox progress bar that shows up when you send mail, but it is not a folder that you can drag and drop items onto. Also, I liked the way Entourage was set up whereby I could script items to be created in the drafts folder, review them, and when ready, drag all of them to the outbox. This solution also is a workaround for this situation as well.

This first script assumes that you have created a folder named “_Outbox” the the “On my computer” email folders list. Outlook won’t let you create a folder named “Outbox”, and naming the folder starting with an underscore puts it at the top of the folder list for easy access."

property to_recip : “”
property cc_recip : “”
property bcc_recip : {“”}
property att : “”
property acct : “” – put your pop account name here, or change the reference below to an imap or exchange account
property subj : “”
property mssg : “”

tell application “FileMaker Pro Advanced”
activate
set to_recip to cell “temp email to recip” of current record
set cc_recip to cell “temp email cc recip” of current record
set bcc_recip to cell “temp email bcc recip” of current record
set att to cell “temp email attachment” of current record
set subj to cell “temp email subject” of current record
set mssg to cell “temp email message” of current record
end tell
tell application “Microsoft Outlook”
set theAccount to pop account acct
tell folder “_Outbox” of theAccount
set tmp to make new outgoing message with properties {subject:subj, content:mssg, account:theAccount}
end tell
if to_recip is not equal to “” then make new to recipient at tmp with properties {email address:{address:to_recip}}
if cc_recip is not equal to “” then make new cc recipient at tmp with properties {email address:{address:cc_recip}}

–this next section takes the FMP field that has multiple email addresses separated by returns, and puts them in the email in the bcc line, in a format that Outlook recognizes (any other way I tried just lists the addresses as a long string which was not recognized as individual email addresses)
set old_delim to AppleScript’s text item delimiters
set AppleScript’s text item delimiters to return
set delimitedList to every text item of bcc_recip
repeat with i from 1 to (count delimitedList’s text items)
set bcc to item i of delimitedList
if bcc_recip is not equal to “” then make new bcc recipient at tmp with properties {email address:{address:bcc}}
end repeat
set AppleScript’s text item delimiters to old_delim
if att is not equal to “” then make new attachment at tmp with properties {file:att} --or {file:choose file}
end tell

Modify this to suit your needs. Once you have some drafts in the _Outbox folder and are ready to send them, run this second script:

property countMessages : “”
tell application “Microsoft Outlook”
set countMessages to count mail folder “_Outbox”'s outgoing messages
tell mail folder “_Outbox”
repeat with i from 1 to countMessages
send object 1
–only need to send object 1 because every message that is sent is deleted from this folder
end repeat
end tell
end tell

You can put this second script in the Outlook script menu (name it something like “_send_outbox” so it appears at the top of the list, and/or assign it a keyboard shortcut using the keyboard preference pane.

-Bob

This will seem lame: is the whole thing in Applescript?

All I want/need to do is to open a new outlook email message with the addressee completed and the subject completed - both these will be in the record in database from which I am sending…
I then want to write the body of the email using Outlook…can this be done?

My solution:
http://fmforums.com/forum/topic/75463-outlookt-11/page__p__357470__fromsearch__1#entry357470

Model: iMac
Browser: Safari 534.10
Operating System: Mac OS X (10.6)