MailExecute
MailExecute[cmd,target]
executes the mail command cmd on the target mail server connection, folder, file or item(s).
Details
- Possible commands cmd for a mail item target include:
-
"Delete" delete a mail item "Flags" list flags for a mail item "SetFlags"{"flag1",…} set flags for a mail item "ClearFlags" clear all flags for a mail item "ClearFlags"{"flag1",…} clear specified flags for a mail item "Copy"MailFolder[…] copy mail item to the specified folder "Upload"MailFolder[…] upload mail item to the specified folder - Possible commands cmd for a mail file target include:
-
"UploadEMLFile"MailFolder[…] upload "EML" type files to the specified folder "UploadMBOXFile"MailFolder[…] upload "MBOX" type files to the specified folder - Possible commands cmd for a mail folder target include:
-
"Expunge" permanently remove all deleted items from a mail folder "Download" download all messages in the specified folder "MarkFolderRead" mark the entire mail folder as read "Create""name" create a folder using "name" in specified folder - Possible commands cmd for a mail server connection target include:
-
"Create""name" create a folder using "name" in the server root directory - For commands operating on mail items, MailExecute[cmd,{MailItem[…],MailItem[…],…}] operates on multiple items.
- MailExecute returns Success or Failure for the following commands: "Delete", "Upload", "UploadEMLFile", "UploadMBOXFile" and "Expunge".
- Commands that manipulate flags return the final list of flags for a mail item, or an association of results for a list of mail items.
- "Copy" returns the resulting MailItem object.
- "Create" and "MarkFolderRead" return the resulting MailFolder object.
- "Download" returns the resulting local File object.
Examples
open allclose allBasic Examples (1)
Scope (1)
Download all emails from the folder:
Import one email as an Association and list its keys:
Applications (1)
You can use MailExecute to permanently delete spam email messages. Connect to a mail server:
Get three messages from the folder:
Text
Wolfram Research (2018), MailExecute, Wolfram Language function, https://reference.wolfram.com/language/ref/MailExecute.html (updated 2020).
CMS
Wolfram Language. 2018. "MailExecute." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2020. https://reference.wolfram.com/language/ref/MailExecute.html.
APA
Wolfram Language. (2018). MailExecute. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/MailExecute.html