FMP and applscript

hey,

I would like to know if it is possible to send mail by apple script to several recipients wich are in a File maker pro dataBase.

Thanks a lot
there is my code, but i can only send to one recipient

Do a find for the records you wish to send first.

The “field” will return the value for all the records
found as a list where “cell” only returns the value of the current record.

Also, when getting the “field” value(s) you need
to address the window or layout.


tell application "FileMaker Pro"
	tell database "correspondants"
		tell window 1
			set theRecipient to field "email"
		end tell
	end tell

--Create a string of addresses from the list
set emailAddresses to ""
repeat with i from 1 to count of theRecipient
	set thisEmail to item i of theRecipient
	set emailAddresses to emailAddresses & thisEmail & ","
end repeat

tell application "Mail"
	activate
	set theMessage to make new outgoing message with properties {visible:true}
	
	tell theMessage
		make new to recipient at end of to recipients with properties {address:emailAddresses}
	end tell
	
end tellend tell

That is ok !!!

Thanks a lot

Just a litte question,

When i have several recipients, i don’t prefer they see other mail adresses. Is possible to do that, Bcc recipients?
;););):wink:

try this


--Create a string of addresses from the list
set emailAddresses to ""

--Set main email
set mainToEmail to item 1 of theRecipient

repeat with i from 2 to count of theRecipient
	set thisEmail to item i of theRecipient
	set emailAddresses to emailAddresses & thisEmail & ","
end repeat

tell application "Mail"
	activate
	set theMessage to make new outgoing message with properties {visible:true}
	
	tell theMessage
		make new to recipient at end of to recipients with properties {address:mainToEmail}
	end tell
	
	tell theMessage
		make new bcc recipient at end of bcc recipients with properties {address:emailAddresses}
	end tell
	
end tell

Hi

This can be easy or complicated depending on your workflow.

I have many scripts that use applescript to search a filemaker database and then send emails out individually to each client so no cc or bcc.

a little more info would be good