Jump to content
Salesforce and other SMB Solutions are coming soon. ×

applescript for automating send mail


Maarten Witberg

Recommended Posts

This is not actually a sample file but some sample code.

It's an applescript that can be used to send mail automatically, without the user having to commit sending in the email program.

 

the filemaker script should run:

 

#you are in a record that you wish to use data from to send a message#
set field ["gTempMailAddress", "MailAddress"]
set field ["gTempBody", "MessageBody"]
perform applescript [blahblah...]

 

then the applescript runs like this:

tell application "FileMaker Pro"
activate
set DBname to "YourFile"
set theAddress to the cellValue of the cell 1 of the field "gTempMailAddress" of the database DBname
set theBody to the cellValue of the cell 1 of the field "gTempBody" of the database DBname
end tell

tell application "Mail"
set theSender to "yourname@yourdomain"
set theSubject to "this is a test message"
set newMessage to make new outgoing message with properties {subject:theSubject, content:theBody, sender:theSender, address:theAddress}
tell newMessage
	make new to recipient with properties {address:theAddress}
end tell
send newMessage
end tell

 

 

You could use globals to pass the subject, the cc recipient and bcc also I guess.

I'm just starting out using applescripts, so anyone who can tell me how to pass a value from a current record instead of using a global will earn my everlasting gratitude.

 

 

kjoe

Link to comment
Share on other sites

Kjoe :}

 

 

That's cool in 5.5 or less but I believe in 6.0 and higher

and OSX.... send mail could be used in normal FileMaker Scripting . IS that right?

Link to comment
Share on other sites

I wrote it in 6/OSX 10.3.9, Apple Mail and Eudora too I believe don't send automatically, you end up with an open message after doing Send Mail[ ]

 

so... how about 7?

 

kjoe

Link to comment
Share on other sites

Well maybe , I left something out I use Dacons Mait plug in and Keep everything in Filemaker 6. I sent out confirmation on 20 -30 different customers everyday. 4000 email in a year.

Link to comment
Share on other sites

This applescript is for when you don't have a plugin... but you do end up with a sent mail in your outbox. so for large volumes it's probably cumbersome. I wrote it to use as a mailalert for messages sent between colleagues (a whopping 7, me included) in my office. so that's limited volume.

 

good night for now!

 

kjoe

Link to comment
Share on other sites

  • 1 month later...

Is there is way to trap or capture body content of mail programtically when mail send option is clicked by client thru AppleScript or any other way.

Link to comment
Share on other sites

You mean the other way round, so the mail content is stored in filemaker? I guess so, but you'd have to look at Apple Mail's scripting library also. I have not got this up my sleeve I am afraid.

 

kjoe

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.



×
×
  • Create New...

Important Information

Terms of Use