YOUSEFUL / FILEMAKER

Youseful Mail: FAQ, examples and tutorial

Learning center · Function reference

Use YsflMail.fmx64 to send SMTP messages, retrieve POP3/IMAP messages and parse MIME content. This first tutorial parses a local fixture: it needs no account and sends no mail.

FAQ

Does Send returning 0 prove delivery to the inbox? It means the SMTP transaction completed successfully. Later delivery, filtering and bounces are handled by the mail system.

Will it work with an OAuth-only mailbox? The current Mail API exposes user/password authentication and SMTP PLAIN/LOGIN, not an OAuth2 token flow. Use an authentication method your test provider actually permits.

Does retrieving an IMAP message mark it as read? ImapGet is implemented to fetch the message without marking it read. Flags and deletion are separate calls.

Can I parse an existing .eml message without connecting? Yes. Supply its raw message text to Header, Body and Attachments. MIME messages use headers followed by a blank line and the body.

Examples

Read a subject:

filemaker
YsflMl_Header (
    "Subject: Hello Youseful" & Char ( 13 ) & Char ( 10 ) & Char ( 13 ) & Char ( 10 ) & "Body" ;
    "Subject"
)

Result: Hello Youseful.

Read a plain-text body:

filemaker
YsflMl_Body (
    "Content-Type: text/plain; charset=UTF-8" &
    Char ( 13 ) & Char ( 10 ) & Char ( 13 ) & Char ( 10 ) &
    "Your order is ready."
)

Result: Your order is ready.

Tutorial

Standalone sample scripts: Parse a message.

Goal: decode an encoded subject and extract a message body.

  1. Create a script named Youseful - Parse a message.
  2. Add these steps. $crlf creates the line ending expected in raw email.
filemaker
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 ]
  1. Run it. Expected title: Hello Youseful. Expected body: Your order is ready.
  2. In a later integration, replace $raw with the result of a successful Pop3Get or ImapGet call. Capture that retrieval error before starting parsing.

Troubleshooting

Keep the blank line between headers and body. Ask Body for html only when you want the HTML part. For a real connection, use your provider's exact hostname, port and TLS mode; for example, an IMAPS endpoint normally specifies port 993. Mailbox UIDs, message indexes and attachment indexes are different identifiers.