<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.returnofreckoning.com/index.php?action=history&amp;feed=atom&amp;title=API%3ASendMailboxCommand</id>
	<title>API:SendMailboxCommand - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.returnofreckoning.com/index.php?action=history&amp;feed=atom&amp;title=API%3ASendMailboxCommand"/>
	<link rel="alternate" type="text/html" href="https://wiki.returnofreckoning.com/index.php?title=API:SendMailboxCommand&amp;action=history"/>
	<updated>2026-10-18T19:24:18Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.43.11</generator>
	<entry>
		<id>https://wiki.returnofreckoning.com/index.php?title=API:SendMailboxCommand&amp;diff=30701&amp;oldid=prev</id>
		<title>Maintenance script: UI Lua API import (WAR 1.4.8)</title>
		<link rel="alternate" type="text/html" href="https://wiki.returnofreckoning.com/index.php?title=API:SendMailboxCommand&amp;diff=30701&amp;oldid=prev"/>
		<updated>2026-10-16T19:48:44Z</updated>

		<summary type="html">&lt;p&gt;UI Lua API import (WAR 1.4.8)&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;{{LuaApi|group=Social}}&lt;br /&gt;
Sends a mailbox command to the server: send a letter, open, delete or return a message, take money or items, mark a message read or unread, or close the mailbox.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
SendMailboxCommand(command, mailboxType, messageId, recipient, subject, body, value, slotIds, backpackTypes, cod)&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Arguments ==&lt;br /&gt;
;command : &amp;lt;code&amp;gt;number&amp;lt;/code&amp;gt; – The command. The stock UI uses the constants in &amp;lt;code&amp;gt;MailWindow&amp;lt;/code&amp;gt;: 0 &amp;lt;code&amp;gt;MAILBOX_CLOSE&amp;lt;/code&amp;gt;, 1 &amp;lt;code&amp;gt;MAILBOX_SEND&amp;lt;/code&amp;gt;, 2 &amp;lt;code&amp;gt;MAILBOX_OPEN_MESSAGE&amp;lt;/code&amp;gt;, 3 &amp;lt;code&amp;gt;MAILBOX_DELETE_MESSAGE&amp;lt;/code&amp;gt;, 4 &amp;lt;code&amp;gt;MAILBOX_RETURN_MESSAGE&amp;lt;/code&amp;gt;, 5 &amp;lt;code&amp;gt;MAILBOX_TAKE_MONEY&amp;lt;/code&amp;gt;, 6 &amp;lt;code&amp;gt;MAILBOX_TAKE_ITEM&amp;lt;/code&amp;gt;, 7 &amp;lt;code&amp;gt;MAILBOX_TAKE_ALL&amp;lt;/code&amp;gt;, 8 &amp;lt;code&amp;gt;MAILBOX_MESSAGE_MARK_READ&amp;lt;/code&amp;gt;, 9 &amp;lt;code&amp;gt;MAILBOX_MESSAGE_MARK_UNREAD&amp;lt;/code&amp;gt;.&lt;br /&gt;
;mailboxType : &amp;lt;code&amp;gt;number&amp;lt;/code&amp;gt; – A &amp;lt;code&amp;gt;GameData.MailboxType&amp;lt;/code&amp;gt; value (&amp;lt;code&amp;gt;PLAYER&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;AUCTION&amp;lt;/code&amp;gt;). Sent as an 8-bit value.&lt;br /&gt;
;messageId : &amp;lt;code&amp;gt;number&amp;lt;/code&amp;gt; – Id of the message the command applies to; 0 for send and close.&lt;br /&gt;
;recipient : &amp;lt;code&amp;gt;wstring&amp;lt;/code&amp;gt; – Name of the receiver (send only).&lt;br /&gt;
;subject : &amp;lt;code&amp;gt;wstring&amp;lt;/code&amp;gt; – Subject line (send only).&lt;br /&gt;
;body : &amp;lt;code&amp;gt;wstring&amp;lt;/code&amp;gt; – Message text (send only).&lt;br /&gt;
;value : &amp;lt;code&amp;gt;number&amp;lt;/code&amp;gt; – For send: the money attached (or asked for, with COD), in brass. For take item: the 0-based index of the attachment. Otherwise 0.&lt;br /&gt;
;slotIds : &amp;lt;code&amp;gt;number-table&amp;lt;/code&amp;gt; – Backpack slot numbers of the items to attach (send only); &amp;lt;code&amp;gt;{}&amp;lt;/code&amp;gt; for none.&lt;br /&gt;
;backpackTypes : &amp;lt;code&amp;gt;number-table&amp;lt;/code&amp;gt; – The backpack type of each entry in &amp;lt;code&amp;gt;slotIds&amp;lt;/code&amp;gt;, in the same order.&lt;br /&gt;
;cod : &amp;lt;code&amp;gt;boolean&amp;lt;/code&amp;gt; – &amp;lt;code&amp;gt;true&amp;lt;/code&amp;gt; to send the letter cash on delivery (send only).&lt;br /&gt;
&lt;br /&gt;
== Returns ==&lt;br /&gt;
Nothing.&lt;br /&gt;
&lt;br /&gt;
== Details ==&lt;br /&gt;
* All ten arguments must always be passed with the right types; the stock UI passes 0, &amp;lt;code&amp;gt;L&amp;quot;&amp;quot;&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;{}&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;false&amp;lt;/code&amp;gt; as fillers.&lt;br /&gt;
* The client copies &amp;lt;code&amp;gt;recipient&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;subject&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;body&amp;lt;/code&amp;gt; into buffers of 24, 30 and 300 characters.&lt;br /&gt;
* Each attachment slot is converted to an inventory slot number using its backpack type. Pairing stops at the end of the shorter table.&lt;br /&gt;
* Any &amp;lt;code&amp;gt;command&amp;lt;/code&amp;gt; above 9 sends nothing.&lt;br /&gt;
* If there is no player object, or the Lua state is not available, nothing is sent.&lt;br /&gt;
* The function needs at least ten arguments and only reads the last ten. &amp;lt;code&amp;gt;cod&amp;lt;/code&amp;gt; must be a real boolean.&lt;br /&gt;
&lt;br /&gt;
== Errors ==&lt;br /&gt;
None besides the generic &amp;#039;&amp;#039;Invalid Parameters&amp;#039;&amp;#039; message when an argument has the wrong type.&lt;br /&gt;
&lt;br /&gt;
== Example ==&lt;br /&gt;
Sending a letter, from &amp;lt;code&amp;gt;default/ea_mailwindow/source/mailwindowtabsend.lua&amp;lt;/code&amp;gt;:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
SendMailboxCommand(MailWindow.MAILBOX_SEND,                             -- Msg type, according to warinterface::LuaSendMailboxCommand&lt;br /&gt;
                   GameData.MailboxType.PLAYER,                         -- Messagebox Type&lt;br /&gt;
                   0,                                                   -- Message ID&lt;br /&gt;
                   L&amp;quot;&amp;quot;..MailWindowTabSendToEditBox.Text,                -- WString for who the message is going to&lt;br /&gt;
                   L&amp;quot;&amp;quot;..MailWindowTabSendSubjectEditBox.Text,           -- WString for the subject line&lt;br /&gt;
                   L&amp;quot;&amp;quot;..MailWindowTabSendMessageBodyEditBox.Text,       -- WSring for the body of the message&lt;br /&gt;
                   money,                                               -- Total value of coins attached&lt;br /&gt;
                   attachmentSlotIDs,                                   -- IDs (which correspond to backpack slot #&amp;#039;s) of attachments&lt;br /&gt;
                   attachmentSlotBackpacks,                             -- Backpack types of corresponding slot ids&lt;br /&gt;
                   ButtonGetPressedFlag(&amp;quot;MailWindowTabSendCODCheckBoxButton&amp;quot;) -- COD&lt;br /&gt;
                   )&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Taking one attachment, from &amp;lt;code&amp;gt;default/ea_mailwindow/source/mailwindowtabmessage.lua&amp;lt;/code&amp;gt;:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
-- Note: Be sure to subtract 1 from the MailWindowTabMessage.attachmentSlot since LUA is 1-based&lt;br /&gt;
SendMailboxCommand(MailWindow.MAILBOX_TAKE_ITEM, GameData.MailboxType.PLAYER, MailWindowTabInbox.SelectedMessageID, L&amp;quot;&amp;quot;, L&amp;quot;&amp;quot;, L&amp;quot;&amp;quot;, MailWindowTabMessage.attachmentSlot-1, {}, {}, false )&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
* [[API:SendGuildVaultCommand|SendGuildVaultCommand]]&lt;br /&gt;
* [[API:AddTemporaryIgnore|AddTemporaryIgnore]]&lt;/div&gt;</summary>
		<author><name>Maintenance script</name></author>
	</entry>
</feed>