×
Namespaces

Variants
Actions
Revision as of 17:22, 11 January 2013 by rostgrm (Talk | contribs)

Sending Emails with RSendAs

From Nokia Developer Wiki
Jump to: navigation, search
Article Metadata
Tested with
Devices(s): Nokia E61i, Nokia C7-00
Platform Security
Capabilities: NetworkServices
Article
Keywords: messages
Created: everyourgokul (24 Apr 2007)
Reviewed: Rostgrm
Last edited: rostgrm (11 Jan 2013)

Code for sending emails

For sending emails the following code can be used.

Warnings

  1. Common:
    • setup at least one email account or you will have KErrNotFound leaves
  2. Devices:
    • sends well since 9.1 without capabilities
    • on Belle devices and above the message is saved to Drafts. If you add NetworkServices it will be sent succesfully.
  3. Emulator prerequisites
    • be sure you have the file at <SDK_PATH>\Epoc32\winscw\c\splash.bmp

Header Required:

#include <rsendas.h>
#include <rsendasmessage.h>
#include <senduiconsts.h>

Library needed:

LIBRARY  sendas2.lib

Source File:

    RSendAs session;
User::LeaveIfError( session.Connect() );
CleanupClosePushL( session );
 
RSendAsMessage sendAsMessage;
sendAsMessage.CreateL( session, KSenduiMtmSmtpUid );
CleanupClosePushL( sendAsMessage );
 
sendAsMessage.SetSubjectL( _L("Welcome back to symbian") );
//adding 'TO' field
sendAsMessage.AddRecipientL( _L("you@me.com"), RSendAsMessage::ESendAsRecipientTo );
 
sendAsMessage.SetBodyTextL( _L("somebody@world.com") );
 
TRequestStatus status;
// adding attachments. Be sure file exists :)
sendAsMessage.AddAttachment( _L("c:\\splash.bmp"), status );
User::WaitForRequest( status );
 
sendAsMessage.SendMessageAndCloseL();
CleanupStack::Pop( &sendAsMessage );
CleanupStack::PopAndDestroy( &session );

The example in original paper was remade from book 'Symbian OS Communications Programming', author Iain Campbell, published in 2007

52 page views in the last 30 days.

Was this page helpful?

Your feedback about this content is important. Let us know what you think.

 

Thank you!

We appreciate your feedback.

×