« MBS Xojo Plugins, ver… | Home | xDev Magazine 21.2 Is… »

Email and MBS Plugin

Recently we got asked what we can do for emailing in MBS FileMaker Plugin and MBS Xojo CURL Plugin. While we recommend not to try and replicate a full Mail client, you can do a lot with our plugins and so let us sum up what we can do:


We provide CURL functions and SendMail functions to send emails with more options than what is built-in to FileMaker.

Send Email

Our plugin can send emails via SMTP protocol. Port is 25 by default, but alternatively you can use port 587 if a firewall blocks port 25. Or for smtps:// protocol we use port 465. When you send an email, you retain the protocol from curl, so you can see what happens. This may show errors like invalid credentials, hitting the email size limit and on the end an OK message from the server for accepting the email.

Build Email

The SendMail functions can build an email with

  • HTML, rich and plain text parts
  • multiple attachments
  • inline graphics for HTML
  • proper unicode encoding.
  • From, To, CC, BCC and Reply to addresses
  • Priority header
  • Read or return receipt request headers
  • Extra custom headers like mailer name.

See also


We can receive emails from a mail server via both IMAP and below POP3 protocols. In general we prefer IMAP since it has features like using unique IDs for emails, which don't change once an email is deleted.

See IMAP Email Example video and IMAP Email example database.


We can list the emails of a mailbox and get a listing with preview data for each email including UID, subject, sender, receiver and date. Please check our IMAP Email example, which shows a list of the email.

It can be modified to load the list in chunks for huge email postboxes. But we regularly suggest to use a separate e-mail postbox on the server and have the server copy all emails you want to download and process automatically there.

e.g. list emails with UID starting with ID 1 and up to last email (*) and return things for each email including flags, server date, size and the following fields: Message-Id, date, from, subject, to, sender, reply-to, CC and BCC:



We can download individual emails. Once loaded, we have EmailParser functions to extract parts like text, html, headers and attachments. Optionally the email can be loaded without marking it as read using the peek option. e.g. to load email with UID 177, you get an URL like this: "imap://domain.com/INBOX;UID=177"


When you send emails via SMTP, you may like to also upload it to the Sent folder. We have an example to upload the email to the IMAP server into a folder. After a successful send, you may then upload the email to Sent folder. Or just do a BCC to yourself.

You provide the email source in the input text for the upload, then set OptionUpload = true and put the folder into the URL, e.g. "imap://domain.com/INBOX.Sent"

See also Upload email to Sent folder via IMAP for Xojo and CURL/Email/IMAP Email Upload for FileMaker.


We can change flags for emails. Flags include Answered, Flagged, Draft, Deleted, Seen or Recent. For example to mark them as unread by clearing the Seen flag or to mark them for deleting with setting Deleted flag.

Delete emails

Deleting emails in IMAP is a two step process. First you mark email for deletion with the Deleted flag and then you later run the command to delete them. Send a custom request with EXPUNGE command to delete all emails marked Deleted. Alternatively email clients move emails first to a trash folder. And then when they empty the trash, they set the flag and run EXPUNGE.


We can move or copy emails to a folder with custom requests.

e.g. a custom request "UID MOVE 1234 INBOX.test" will move email with UID 1234 to the test folder in the INBOX.


You can query the quota settings and know how big the mailbox can be. Just run the GETQUOTA custom request.


You can run search requests to find e.g. new emails.

See also


Beside IMAP, we can also do POP3.


We can list the emails for POP3 by running a request with a pop3 URL with no path, e.g. pop3://mail.domain.com


We can download individual emails. e.g. use an URL like pop3://mail.domain.com/1 with the email number in the end. Please note that email numbers change when you delete emails. Once loaded, we have EmailParser functions to extract parts like text, html, headers and attachments.


The plugin can send custom commands like a delete command to the server. This happens with the same URL as to load the email, but with a custom request being "DELE".


All connections can be done with TLS 1.2 or 1.3, either using STARTTLS or direct SSL connection. For the later, use s in the protocol name, e.g. imaps://.

Do login via user name and password or token:

  • NTML
  • CRAM MD5
  • XOAUTH bearer for oAuth 2.0

We have an example for FileMaker on how to do oAuth 2.0 with Office 365 mailboxes. But that could be adapted to other services.

See also

Please don't hesitate to contact us if you have questions.

01 03 23 - 10:23