[PocketPC] send MMS using MAPI
- From: nvmdwm2008 <noreply@xxxxxxxxxxx>
- Date: Tue, 30 Sep 2008 08:22:57 +0000 (UTC)
This is for PocketPC. I posted on the pocketpc.developer newsgroup but no replies so I posted it here. :)
How do I send an MMS using CEMAPI? Currently I use several code snippets designed to send SMS and modify them to send MMS. I end up with the following code snippet which can placed the MMS into MMS Outbox folder and cause the phone to attempt to send the MMS, but a failure (error message: Unable to send MMS. Your message will remain in Outbox folder.) is reported just after the MMS data connection is established. The native composer can send and receive MMS successfully.
Code snippet:
// pointer to folder having PR_CE_IPM_DRAFTS_ENTRYID in message store with PR_DISPLAY_NAME = "MMS", e.g. drafts folder of MMS account
// This has been retrieved (code not shown)
IMAPIFolder* pfldrDrafts = NULL;
//pointer to message being created
LPMESSAGE pmsg;
//create the message to be sent
hr = pfldrDrafts->CreateMessage(NULL, 0, &pmsg);
//add recipients
SPropValue propRecipient[3]; ZeroMemory(&propRecipient, sizeof(propRecipient)); propRecipient[0].ulPropTag = PR_RECIPIENT_TYPE; propRecipient[0].Value.l = MAPI_TO; propRecipient[1].ulPropTag = PR_ADDRTYPE; propRecipient[1].Value.lpszW = L"MMS"; //originally this is L"SMS", I changed to MMS to point to MMS account
propRecipient[2].ulPropTag = PR_EMAIL_ADDRESS; propRecipient[2].Value.lpszW = L"111111"; //recipient phone number
ADRLIST adrlist; adrlist.cEntries = 1; adrlist.aEntries[0].cValues = 3; adrlist.aEntries[0].rgPropVals = (LPSPropValue)(&propRecipient); hr = pmsg->ModifyRecipients(MODRECIP_ADD, &adrlist);
//change other properties
SPropValue props[4]; ZeroMemory(&props, sizeof(props));
//PR_SUBJECT points to MMS contents. For simplicity, the MMS body and attachments
(pictures, audio has not yet been set)
props[0].ulPropTag = PR_SUBJECT; props[0].Value.lpszW = L"Hello World"; //message subject
//mark message as being sent out
props[1].ulPropTag = PR_MSG_STATUS;
props[1].Value.ul = MSGSTATUS_RECTYPE_SMS; //is it OK to use this flag (designed
for SMS)? or is there a similiar flag for MMS?
props[2].ulPropTag = PR_MESSAGE_FLAGS; props[2].Value.ul = MSGFLAG_FROMME | MSGFLAG_UNSENT;
//assign the property to the message
hr = pmsg->SetProps(sizeof(props) / sizeof(props[0]), (LPSPropValue)&props, NULL);
//send the message
hr = pmsg->SubmitMessage(0);
The above code can send SMS successfully just by modifying pfldrDrafts to point to SMS messag store and change propRecipient[1].Value.lpszW as commented.
Any ideas what I am missing out on? Thanks in advance. :)
Posted by JetBrains Omea Reader 1098.1
.
- Prev by Date: setting recipient name when creating a message via IMAPIFolder::CreateMessage
- Next by Date: MAPI: CustomForm and TransportDemo samples
- Previous by thread: setting recipient name when creating a message via IMAPIFolder::CreateMessage
- Next by thread: MAPI: CustomForm and TransportDemo samples
- Index(es):
Relevant Pages
|