Android Question NET Library, SMTP and the Sender Object

SeaCay

Member
Licensed User
Hello All,

My question revolves around the Sender object which I believe should be trappable in the "MessageSent" event. To be quite clear on this I am not talking about the sender (email address) of the message, but I am referring to the sender object representing the object that sent the message.

The Wiki says...
Sender As Object
Returns the object that raised the event.
It is only valid while inside the event sub.
Example:


  • Sub Button_Click

    • Dim b As Button
      b = Sender
      b.Text = "I've been clicked"
    End Sub
My testing shows that the sender (as SMTP) object is always null. This arises even when my originating SMTP object is still in global scope (please don't suggest using the global object). I am hoping that the quoted Wiki entry is true for all objects but I seem unable to trap the SMTP object.

Is this correct that Sender is not available in the MessageSent event?

As always, I thank you for your help and support.

regards

SeaCay
 

SeaCay

Member
Licensed User
Hello Erel,

Please can you advise if this issue has been corrected? Or. if not, a potential fix date?

regards and thanks

SeaCay
 

SeaCay

Member
Licensed User
Hello Erel,

I have implemented the Net library you sent yesterday.
Although the Sender object is no longer Nil, the Sender attributes don't seem to have any values.
For example, from the MessageSent event:

B4X:
Dim aMsg As SMTP
Dim aSbj As String
   
        aMsg = Sender
        aSbj = aMsg.Subject
When examining the aSbj variable, it is an empty string.

Do you know why this would be so?

regards

SeaCay
 
Last edited:

SeaCay

Member
Licensed User
Hello Erel,

Again my thanks for getting back to me so quickly.

I understand what you have said but I wonder if clearing the SMTP object values is something the application developer should do? Of course having made that point I do not know how the SMTP object has been written so it could be difficult/impossible for the application developer to clear.

So here's my thinking,
I create, configure and dispatch a SMTP message.
I have a message event (MessageSent) triggered that accesses a SMTP Sender object.
But the Sender object has been cleared along the way, so it is of no use to me for post dispatch evaluation.
Surely if the sender has been cleared, the SMTP(sender) object copied to the MessageSent Event it is meaningless?
And this probably explains why it was nil at the outset of this discussion thread.

What I am trying to do

One of my apps sends many emails to various government departments. One of the email messages has a keyword in the subject that I use as a trigger to prevent further processing. I need to know that the message has been sent successfully and therefore need the MessageSent event for both the success status variable and to know to which message the success relates from the presence of a keyword in the subject. If the Sender.subject could be evaluated, I could trigger the code to prevent further activity from within the MessageSent event. In short I need the Sender.Subject and the success status flag to complete this task.

I value your thoughts.

regards and thanks

Colin
 

SeaCay

Member
Licensed User
Hello Erel,

I am using one only SMTP object.

I have decided to change my approach and redirect the "MessageSent" event for the termination message to a different, compliant event handler.
This way I can get most of the info I need and determine send success/failure. Early testing indicates that this is sufficient.

If you should update/re-write the SMTP object so that it is not cleared between sending and notification, please let me know.

Many thanks for your help.

regards

SeaCay
 
Top