1. damian jimenez
  2. PowerBuilder
  3. Thursday, 21 March 2024 15:45 PM UTC

I have problems sending the email asynchronously, the emails send them perfect, but I cannot scratch values in the Osendfinished event
While I turn the content in a variables that, at the end of sending several emails, it is never filled with any value

I attach a video and the source code in TXT format.
sorry but it is difficult to decouple all the code used to send that part only
I hope what I send
thank you so much

Video with more 20mb ->   https://youtu.be/xUeyyUDpKiY


https://youtu.be/xUeyyUDpKiY


https://youtu.be/xUeyyUDpKiY

Attachments (1)
Accepted Answer
Ken Guo @Appeon Accepted Answer Pending Moderation
  1. Friday, 22 March 2024 02:47 AM UTC
  2. PowerBuilder
  3. # Permalink

Hi Damian,

Based on the video you provided, there seems to be a design issue in your code, as shown in the attached screenshot:
Your n2_smtp object inherits from smtpclient, and you have written code in the OnSendFinished event of n2_smtp to capture the return value.
However, when you call the SendAsync function, you are using the n2_smtpclient object, which is an SMTPClient object, not n2_smtp object. Therefore, it will not trigger the OnSendFinished event of the n2_smtp object.

I suggest you try modifying it as follows:
1. In the Instance Variables of n2_smtp, delete code SMTPClient n2_smtpClient.
2. Replace all the “n2_smtpClient.” in the n2_smtp object with “This.” and save it.
3. When other places need to use the n2_smtp object to send emails, I suggest you declare it as Global Variable or Instance Variable and do not immediately destroy it after sending the emails.

 

Regards,

Ken

Comment
There are no comments made yet.
Chris Pollach @Appeon Accepted Answer Pending Moderation
  1. Thursday, 21 March 2024 19:31 PM UTC
  2. PowerBuilder
  3. # 1

Hi Damian ;

  • What version & build of PB are you using?
  • What version & build of the O/S are you using?

Regards .. Chris

Comment
There are no comments made yet.
damian jimenez Accepted Answer Pending Moderation
  1. Friday, 22 March 2024 11:19 AM UTC
  2. PowerBuilder
  3. # 2

That great Ken, thank you very much, I pass a thousand times through there and I did not see it ...

my inherited object was badly defined ..

I corrected your advice and works perfect ... excellent !!!..
thank you very much .. have a good day     ;)

Comment
  1. Ken Guo @Appeon
  2. Tuesday, 26 March 2024 08:30 AM UTC
Thanks for the update :)
  1. Helpful
There are no comments made yet.
  • Page :
  • 1


There are no replies made for this question yet.
However, you are not allowed to reply to this question.