It's not quite as simple as the code above, but it's not horrifically complex. Anything having to do with the server usually is a SOAP call to the backend. The easiest way to figure that out is to grab firebug, and watch the network traffic to get a example. Then look it up in SOAP.txt
The command you want to look at is SendMsgRequest
Code:
# origid will be present if this is a reply or forward
# TODO: indicate whether to save in SentMail (or some other folder)
+ add="1" on recipient email address means to add to caller's address book (no duplicate checking!)
+ supports (f)rom, (t)o, (b)cc, (c)c, (r)eply-to "type" on <e> elements
+ only allowed one top-level <mp> but can nest <mp>s within if multipart/*
+ on reply/forward, set origid on <m> element and set rt to "r" or "w", respectively
+ can optionally set identity-id to specify the identity being used to compose the message
+ if noSave="1", a copy will *not* be saved to sent regardless of account/identity settings
<SendMsgRequest [suid="{send-uid}"] [needCalendarSentByFixup="0|1"] [noSave="0|1"]>
<m [origid="..." rt="r|w"] [idnt="{identity-id}"]>
<e t="{type}" a="{email-address}" p="{personal-name}" [add="1"]/>+
<su>{subject}</su>*
[<irt>{Message-ID header for message being replied to}</irt>]
<mp ct="{content-type}">
<content>...</content>
</mp>
<attach [aid="{attach-upload-id}"]>
[<m id="{message-id}"/>]*
[<mp mid="{message-id}" part="{part-id}"/>]*
[<cn id="{contact-id}"/>]*
</attach>
</m>
</SendMsgRequest> The standard Zimbra code handles most of the header information (in particular the authtoken).
Code:
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope">
<soap:Header>
<context xmlns="urn:zimbra">
<userAgent name="ZimbraWebClient - FF2.0 (Win)" version="4.5.4_GA_763.FC4"/><sessionId id="111" />
<change token="59553" type="new"/>
<authToken>(REMOVED)</authToken>
<format type="js"/></context>
</soap:Header>
What you need to construct is a SendMsgRequest:
Code:
<soap:Body>
<SendMsgRequest xmlns="urn:zimbraMail" suid="1177704687970"><m idnt="2199a0c6-568b-11da-92a1-efa4f3028220"><e t="t" a="josh@hisdomain.com"/>
<e t="f" a="josh@hisdomain.com" p="Joshua R. Prismon"/>
<su>This is the message title</su>
<mp ct="multipart/alternative">
<mp ct="text/plain">
<content>This is the message content </content>
</mp>
<mp ct="text/html"><content><html><head><style type='text/css'>body
{ font-family: 'Arial'; font-size: 12pt; color: #000000}</style></head><body>This
is the message content<br></body></html></content></mp></mp></m></SendMsgRequest>
</soap:Body></soap:Envelope> ZmCsfeCommand is the mechanism that you can use to send this directly to the server.