April 26, 200520 yr hello all, osx has its own inbuild smtp server, not a secret. i have a script with only one step (perform applescript) which contains this do shell script "echo hello | mail -s 'test' [email protected]" this sends one email with the content hello and the subject test to [email protected]. now the question is how can i parse the contents of a text field instead of just hello? i must somehow let it know which field, like set the field to somefield, and then call it with echo $field i believe. any ideas? overrider
April 26, 200520 yr Hi, this works for me. If the text field you want to send has paragraph returns in it then it needs to be converted - something to do with using unix return marks etc, not 100% sure of the correct explanation, but it also hase to be done when calling Visual Basic commandss from within applescript. code:________________________________________ --this ON statement converts the line endings on ConvertLineEndings(thefield) set oldelim to AppleScript's text item delimiters try set theLines to paragraphs of thefield set AppleScript's text item delimiters to {return} set thefield to theLines as string set AppleScript's text item delimiters to oldelim on error set AppleScript's text item delimiters to oldelim end try end ConvertLineEndings -- this is an example text field set thefield to "blah blah blah blah blah blah blah blah blah" set thefieldconvert to my ConvertLineEndings(thefield) set thescript to "echo " & thefieldconvert & "| mail - s'test' [email protected]" do shell script thescript end of code__________________________________________ If you want to get the text field from filemaker then just replace the SET THEFIELD line with: Tell app filemaker pro" tell document 1 set thefield to cell "thetext" end tell end tell there are probably better ways to do this but i hope its of some help.
April 27, 200520 yr Author there was a space after the mail command, it must look like mail -s though, so that was the reason for the "No mail for admin" message. however, after correcting this, it send an email, but not with the contents of the field i specified. so i had to take out all the converting parts, cause i did not understand them. in the end, this script worked for me, sending an email with the contents of the field i specified. set thefield to cell "somefield" of current record of current layout set thescript to "echo " & thefield & "| mail -s 'test' [email protected]" do shell script thescript however, this does not take care of linebreaks yet, as pointed out, but i cant fix it.
August 18, 200520 yr Hi there, Just noticed this post and was wondering if it is at all possible to use the OSX smtp server to do all of this but to also add attachments to the email and even possibly multiple attachments to build a kind of mini email client. Any help on this would be greatly appreciated. Regards, Mark Bowen
Create an account or sign in to comment