1. David Peace (Powersoft)
  2. PowerBuilder
  3. Wednesday, 31 January 2024 16:05 PM UTC

Hi Guys

Just running a test withthe new SMTPClient and found this:

SMTPClient.Message.Reset() does not clear the HTMLBody string

If you then try and send a Text only message setting the TextBody, when you send the email it goes withthe previous HTML Body content and not the Text Content!

Theres a simple work around, but has anyone else seen/reported this?

Cheers

David

Accepted Answer
Chris Pollach @Appeon Accepted Answer Pending Moderation
  1. Wednesday, 31 January 2024 16:21 PM UTC
  2. PowerBuilder
  3. # Permalink

Hi David;

  According to the PB documentation, the Reset() command argument only clears he following ..

  • 0 -- (Default) Reset all the following types
  • 1 -- Reset Recipients
  • 2 -- Reset Ccs
  • 3 -- Reset Bccs
  • 4 -- Reset Attachments
  • 5 -- Reset LinkedResources
  • 6 -- Reset Sender

You would need need to create an enhancement support ticket for the Reset command to handle the body section. As a workaround though, I would just Destroy all the SMTP object(s) and the cycle through rebuilding a new SMTP message set to get around this limitation.  HTH

Regards .. Chris

Comment
  1. David Peace
  2. Wednesday, 31 January 2024 16:40 PM UTC
Yes Chris,

I'm not quite sure why the Body contents needs to be in 2 separate boxes. I would have used 1 box and a boolean for HTML. The issue is not just the Reset, but also if you set the HTML and then the Text the HTML overrides the Text. If you are going to have 2 boxes for the same type of content that is mutually exclusive then it needs to clear the alternate one when you set the other.



Just my thoughts.



All the best

David
  1. Helpful 2
There are no comments made yet.
Julie Jiang @Appeon Accepted Answer Pending Moderation
  1. Thursday, 1 February 2024 03:07 AM UTC
  2. PowerBuilder
  3. # 1

Hi David, 

The way that the Reset function works is the same as the other email solutions. It only resets the recipients and attachments that were specified in the mail functions. As for body, priority and encoding, these are properties that shall be reset by setting the value to null. 

Best regards, Julie

Comment
  1. David Peace (Powersoft)
  2. Friday, 2 February 2024 11:59 AM UTC
I think that the confusion comes wityh the Appeon SMTP object having 2 properties for the Email Body. One for HTML and one for plain Text. Personally I thinnk if you set one it should clear the other. Especially as the HTML overrides the Text so setting the Test will leave the HTML content and send that to the next recipient.



Clearly it's easy for us to code round, but I just feel that this is something that would make the PB SMTP object a bit cleaner.



Thanks

David
  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.