# Youseful Software - FileMaker sample script
# Script name: Youseful - Parse a message
# Plug-in: YsflMail.fmx64 (Windows x64)
# Setup: No fields, mail account, or network access needed. This parses a small raw message embedded in the script.
# Expected: Dialog title: Hello Youseful. Body: Your order is ready.
# Format: UTF-8 Script Workspace step listing. Add the steps manually; this is not an importable FileMaker file.
# Lines beginning with # are notes; optionally add them as Comment steps.
# Preserve calculation quotes, backslashes, and paragraph symbols exactly.

Set Variable [ $crlf ; Value: Char ( 13 ) & Char ( 10 ) ]
Set Variable [ $raw ; Value:
    "From: sender@example.com" & $crlf &
    "To: reader@example.com" & $crlf &
    "Subject: =?UTF-8?Q?Hello_Youseful?=" & $crlf &
    "MIME-Version: 1.0" & $crlf &
    "Content-Type: text/plain; charset=UTF-8" & $crlf & $crlf &
    "Your order is ready."
]
Set Variable [ $subject ; Value: YsflMl_Header ( $raw ; "Subject" ) ]
Set Variable [ $error ; Value: YsflMl_LastError ]
If [ $error <> 0 ]
    Exit Script [ Text Result: $subject ]
End If
Set Variable [ $body ; Value: YsflMl_Body ( $raw ; "text" ) ]
Set Variable [ $error ; Value: YsflMl_LastError ]
If [ $error <> 0 ]
    Exit Script [ Text Result: $body ]
End If
Show Custom Dialog [ $subject ; $body ]
