×

Discussion Board

Results 1 to 8 of 8
  1. #1
    Regular Contributor
    Join Date
    Nov 2008
    Location
    Australia
    Posts
    88

    Determining if an email has been sent

    Can anyone help with determining if an email has been successfully sent?

    I am using a simplified version of code to send messages by employing RSendAsMessage but in an Active Object. I have set up an SMTP email send and an IMAP receive mailbox.

    I currently have an empty observer HandleSessionEventL(TMsvSessionEvent aEvent, TAny* aArg1, TAny* aArg2, TAny* aArg3)

    I understand I can use this observer to detect the message has been delivered but after much research and reading I am struggling how to do this. I need to make sure I am not confusing events eg creating a message, deleting sent items, etc. Note it is possible a message can move from sent to outbox but still not be delivered.

    Can anyone help?

    Down the track I want to add code to this observer to check for any incoming mails so need to distinguish this as well.
    David4x

  2. #2
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Budapest, Hungary
    Posts
    28,568

    Re: Determining if an email has been sent

    You will not confuse them since they trigger different TMsvSessionEvent-s. For a successful sending I would expect a Move event between the Outbox and the Sent folders.

  3. #3
    Regular Contributor
    Join Date
    Nov 2008
    Location
    Australia
    Posts
    88

    Re: Determining if an email has been sent

    Ok thanks for responding - I will try it. I

    A quick new question - in preparation of having common server session I attempted to put

    Code:
    CMsvSession* msgSession = CMsvSession::OpenSyncL( *this );
    in my constructor

    Code:
    class CMessageEngine : public CActive, public MMsvSessionObserver
    	{
    public:
        static CMessageEngine* NewL(MMessageEngineObserver& aObserver);
    but I get a compile error

    error: invalid use of member `CMessageEngine::msgSession' in static member function MessageEngine.h

    Why is this?
    David4x

  4. #4
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Budapest, Hungary
    Posts
    28,568

    Re: Determining if an email has been sent

    The compiler is usually right. Note that this is not Java, and you can not initialize your member variables in the header file.
    "CMsvSession* iMsgSession;" should appear in your .h file, and
    "iMsgSession = CMsvSession::OpenSyncL( *this );" should appear in your ConstructL method.

  5. #5
    Regular Contributor
    Join Date
    Nov 2008
    Location
    Australia
    Posts
    88

    Re: Determining if an email has been sent

    That's exactly how I did it and why I can't see the problem
    David4x

  6. #6
    Regular Contributor
    Join Date
    Nov 2008
    Location
    Australia
    Posts
    88

    Re: Determining if an email has been sent

    The first complaint is a result of the header file
    David4x

  7. #7
    Regular Contributor
    Join Date
    Nov 2008
    Location
    Australia
    Posts
    88

    Wink Re: Determining if an email has been sent

    OK I discovered what I have to do. C++ did not like the use of the server session creation in the STATIC newL function so I added a ConstructL and this was acceptable (yet to prove it works mind you...)

    Code:
    CMessageEngine* CMessageEngine::NewL(MMessageEngineObserver& aObserver)
        {    
        CMessageEngine* self = new(ELeave) CMessageEngine(aObserver);
        CActiveScheduler::Add(self);
        self->ConstructL();
        return self;
        }
    
    // Establish session with server
    void CMessageEngine::ConstructL() 
    	{
    	iMsgSession = CMsvSession::OpenSyncL( *this );
    	}
    PS You will note I took on board your format corrections - all tips appreciated...
    David4x

  8. #8
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Budapest, Hungary
    Posts
    28,568

    Re: Determining if an email has been sent

    Static methods are static because they can be (and actually they are) invoked without having an object. Because there is no object, you can not access its member variables.
    Introducing the ConstructL method was the right step. However if you watch closely, you invoked the member function "ConstructL" on "self". The same applies to member variables, so "self->iMsgSession = CMsvSession::OpenSyncL( *self );" would have worked too.

Similar Threads

  1. How to Close built in Email Client Application
    By om.prakash in forum Symbian Networking & Messaging (Closed)
    Replies: 5
    Last Post: 2008-11-26, 08:05
  2. Checking for new email
    By smileyyhl in forum Symbian Networking & Messaging (Closed)
    Replies: 5
    Last Post: 2008-06-12, 09:03
  3. 6300: Email client disappeared.
    By mcdj in forum General Development Questions
    Replies: 1
    Last Post: 2007-06-20, 21:14
  4. Replies: 0
    Last Post: 2005-07-27, 12:03
  5. email mtm help is needed
    By siemensc55 in forum Symbian
    Replies: 0
    Last Post: 2004-07-18, 18:58

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •