locked
How to send SMS to multiple recipients? RRS feed

  • Question

  • Hi all,

    How to send SMS to multiple recipients including an award of their own? i can send SMS to one recipient by using API SmsSendMessage now.
    Friday, May 15, 2009 11:33 AM

Answers

  • Hi,

    The following code might point you in the right direction :-

    Microsoft.WindowsMobile.PocketOutlook.OutlookSession currentSession = new Microsoft.WindowsMobile.PocketOutlook.OutlookSession();
    
    Microsoft.WindowsMobile.PocketOutlook.SmsMessage currentSmsMessage = new Microsoft.WindowsMobile.PocketOutlook.SmsMessage();
    currentSmsMessage.To.Add(new Microsoft.WindowsMobile.PocketOutlook.Recipient("0123456789"));
    currentSmsMessage.To.Add(new Microsoft.WindowsMobile.PocketOutlook.Recipient("0987654321"));
    			
    currentSmsMessage.Body = "This is a test";
    
    currentSession.SmsAccount.Send(currentSmsMessage);

    You need to add references to Micrsoft.WindowsMobile and Microsoft.WindowsMobile.PocketOutlook.

    Hope this helps.

    Paul Diston


    http://www.smartmobiledevice.co.uk/
    • Marked as answer by Zeng_Zeng Monday, May 18, 2009 6:14 AM
    Friday, May 15, 2009 11:59 AM

All replies

  • Hi,

    The following code might point you in the right direction :-

    Microsoft.WindowsMobile.PocketOutlook.OutlookSession currentSession = new Microsoft.WindowsMobile.PocketOutlook.OutlookSession();
    
    Microsoft.WindowsMobile.PocketOutlook.SmsMessage currentSmsMessage = new Microsoft.WindowsMobile.PocketOutlook.SmsMessage();
    currentSmsMessage.To.Add(new Microsoft.WindowsMobile.PocketOutlook.Recipient("0123456789"));
    currentSmsMessage.To.Add(new Microsoft.WindowsMobile.PocketOutlook.Recipient("0987654321"));
    			
    currentSmsMessage.Body = "This is a test";
    
    currentSession.SmsAccount.Send(currentSmsMessage);

    You need to add references to Micrsoft.WindowsMobile and Microsoft.WindowsMobile.PocketOutlook.

    Hope this helps.

    Paul Diston


    http://www.smartmobiledevice.co.uk/
    • Marked as answer by Zeng_Zeng Monday, May 18, 2009 6:14 AM
    Friday, May 15, 2009 11:59 AM
  • Thanks for your help.

    you inplement it by using C#, could you show me how to send SMS to multiple recipients in Win32 by using c++? thanks again.
    Friday, May 15, 2009 12:04 PM
  • Hi,

    This MSDN page contains a list of the POOM samples that are provided with the WM SDK, some are written in C++ :-

    http://msdn.microsoft.com/en-us/library/bb445978.aspx

    For future reference, if you wanted a sample written in C++, you should really have stated this in your original question, or better still posted in the Native C++ project forum http://social.msdn.microsoft.com/Forums/en-US/vssmartdevicesnative/threads

    Hope this helps.

    Paul Diston


    http://www.smartmobiledevice.co.uk/
    Friday, May 15, 2009 12:09 PM
  • // Open an SMS handle
    hRet = SmsOpen(SMS_MSGTYPE_TEXT, SMS_MODE_SEND, &hSMS, NULL);
    
    // Send SMS to different server number
    for(UINT i = 0; i < m_vServerNo.size(); i ++)
    {
        // Set up provider specific data.
        tpsd.dwMessageOptions   = PS_MESSAGE_OPTION_NONE;
        tpsd.psMessageClass     = PS_MESSAGE_CLASS1;
        tpsd.psReplaceOption    = PSRO_NONE;
        tpsd.dwHeaderDataSize   = 0;
    
        // Setting SMS Destination address.
        smsaDestination.smsatAddressType = SMSAT_INTERNATIONAL;
        hRet = StringCbCopy(smsaDestination.ptsAddress, SMS_MAX_ADDRESS_LENGTH, m_vServerNo.at(i));
    
        // Send SMS
        hRet = SmsSendMessage(  hSMS,
                                NULL, 
                                &smsaDestination,
                                NULL,
                                (PBYTE) szSMSContent,
                                _tcslen(szSMSContent) * sizeof(TCHAR),
                                (PBYTE) &tpsd, 
                                sizeof(TEXT_PROVIDER_SPECIFIC_DATA), 
                                SMSDE_OPTIMAL, 
                                SMS_OPTION_DELIVERY_NONE, 
                                &smsmidMessageID);
    }

    The following code can send SMS to multiple recipients, but after sending SMS to their own, the next send process will be failed?

    Friday, May 15, 2009 12:20 PM
  • good one.. working fine
    Thursday, March 8, 2012 8:43 AM