Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

mailing using applescript and osx inbuild smtp

Featured Replies

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

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.

  • Author

hmmm...just tells me "No Mail for Admin" when i execute the Applescript

  • 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.

  • 3 months later...

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

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.