# Introduction `MSG` is a command introduced with [MSNP2](../versions/msnp2.md). It is a Notification and Switchboard Server command, WITH a request and WITH a response payload. Used to transfer MIME-headered data to other parties, whenever that be you or other users. # Client/Request ``` MSG TrID [ U | N | A | D ] length data ``` ## Acknowledgement Types * U: Unacknowledged, no response is sent. * A: Acknowledged, a [ACK](ack.md) response is sent if the message is sent successfully. * N: Negative-Acknowledged, a [NAK](nak.md) response is sent if the messaged failed to send successfully. * D: Data, a version of Acknowledged that also has a response of error 282 if the message was poorly formatted. Acknowledgement Type `D` is defined since [MSNP9](../versions/msnp9.md). Where `length` is the `length` in bytes of `data`. Where `data` is the body of the message, usually containing a `MIME-Version` header and a `Content-Type`. *This can only be sent from Switchboard.* # Server/Response ``` MSG user-handle friendly-name length data ``` Where `user-handle` is either the senders's handle, or `Hotmail`, if sent from the Notification Server itself. Where `friendly-name` is either the URL-encoded Friendly Name of the sender, or `Hotmail`, if sent from the Notification Server itself. Where `length` is the `length` in bytes of `data`. Where `data` is the body of the message, usually containing a `MIME-Version` header and a `Content-Type`. # Examples ## Client initated ### Unacknowledged message ``` C: MSG 1 U 75 MIME-Version: 1.0 Content-Type: text/plain;charset=UTF-8 unacknowledged ``` ### Acknowledged message ``` C: MSG A 2 73 MIME-Version: 1.0 Content-Type: text/plain;charset=UTF-8 acknowledged S: ACK 2 ``` ### Negative-Acknowledged message ``` C: MSG 3 2 85 MIME-Version: 1.0 Content-Type: text/plain;charset=UTF-8 negatively acknowledged? S: NAK 3 ``` ### Data message *Since [MSNP9](../versions/msnp9.md).* ``` C: MSG 4 D 73 MIME-Version: 1.0 Content-Type: application/octet-stream data message S: ACK 4 ``` ### Poorly formatted data message *Since [MSNP9](../versions/msnp9.md).* ``` C: MSG 5 D 74 MIME-Version: 1.0 Content-Type: text/plain;charset=UTF-8 data message? S: 282 5 ``` ### Invalid context (Notification Server) *Inherited from being an unimplemented command.* ``` C: MSG 6 U 0 ``` Server disconnects client. ## Server initated ### Notification Server #### Initial profile *NOTE: This profile is from [MSNP2](../versions/msnp2.md), later versions have longer initial profiles.* ``` S: MSG Hotmail Hotmail 95 MIME-Version: 1.0 Content-Type: text/x-msmsgsprofile; charset=UTF-8 LoginTime: 1726321960 ``` #### Initial e-mail configuration *NOTE: This message is from [MSNP3](../versions/msnp3.md), the [MSNP2](../versions/msnp2.md) version of this is unknown.* ``` S: MSG Hotmail Hotmail 221 MIME-Version: 1.0 Content-Type: text/x-msmsgsinitialemailnotification; charset=UTF-8 Inbox-Unread: 1 Folders-Unread: 0 Inbox-URL: /cgi-bin/HoTMaiL Folders-URL: /cgi-bin/folders Post-URL: http://www.hotmail.com ``` #### New e-mail ``` S: MSG Hotmail Hotmail 342 MIME-Version: 1.0 Content-Type: text/x-msmsgsemailnotification; charset=UTF-8 From: Example User Message-URL: /cgi-bin/getmsg?msg=MSG1728932553.00&start=1&len=12&curmbox=ACTIVE Post-URL: https://loginnet.passport.com/ppsecure/md5auth.srf?lc=1033 Subject: Just saying hello. Dest-Folder: ACTIVE From-Addr: example@hotmail.com id: 2 ``` Since [MSNP3](../versions/msnp3.md), the `id` header was added for Passport automatic authentication support. #### Mailbox activity ``` S: MSG Hotmail Hotmail 146 MIME-Version: 1.0 Content-Type: text/x-msmsgsactivemailnotification; charset=UTF-8 Src-Folder: ACTIVE Dest-Folder: ACTIVE Message-Delta: 1 ``` #### System message *NOTE: There may be other types of system messages, `Type` 1 is for a server shutdown message, `Arg1` in this case would be the minutes before the server is set to shutdown.* ``` S: MSG Hotmail Hotmail 88 MIME-Version: 1.0 Content-Type: application/x-msmsgssystemmessage Type: 1 Arg1: 5 ``` ### Switchboard Server ``` S: MSG example@hotmail.com example%20user 73 MIME-Version: 1.0 Content-Type: text/plain;charset=UTF-8 acknowledged ``` # Known changes * [MSNP3](../versions/msnp3.md): Switchboard: Added support for the `X-MMS-IM-Format` header. * [MSNP9](../versions/msnp9.md): Switchboard: Added acknoledgement type D.