NetTalk Central

Author Topic: Processing incoming mail via Postmark  (Read 2235 times)

JohanR

  • Sr. Member
  • ****
  • Posts: 375
    • View Profile
    • Email
Processing incoming mail via Postmark
« on: February 28, 2024, 01:54:40 AM »

Hi

Am trying to process incoming mail being sent to a webhook
The data declaration below is for the attachments on the mail

The "Content" field will contain the attachment.
Total cumulative size for all Inbound attachment files may not exceed 35 MB

How do I change the declaration of "Content" to variable length?
The length is specified in "ContentLength" but I need to change STRING(255) to expect a variable length

After the structure change , would I have to change the loading code?

thanks

Johan

from the postmark docs
 
],
  "Attachments": [
    {
      "Name": "test.txt",
      "Content": "VGhpcyBpcyBhdHRhY2htZW50IGNvbnRlbnRzLCBiYXNlLTY0IGVuY29kZWQu",
      "ContentType": "text/plain",
      "ContentLength": 45
    }
  ]

generated code and structure from capesoft codewriter


AttachmentsQueueType      Queue,Type,Name('Attachments')
Name                       STRING(255),Name('Name')
Content                    STRING(255),Name('Content')
ContentType                STRING(255),Name('ContentType')
ContentLength              Real,Name('ContentLength')
                         End

json.NewPointer          Procedure(*Cstring pGroupName, *CString pColumnName)
  ! note that pColumnName is the json tag name, not the label. case sensitive.
  Code
  case pGroupName & '.' & pColumnName
  Of 'group.ToFull'
    element.ToFull &= NEW ToFullQueueType
  Of 'group.CcFull'
    element.CcFull &= NEW CcFullQueueType
  Of 'group.BccFull'
    element.BccFull &= NEW BccFullQueueType
  Of 'group.Headers'
    element.Headers &= NEW HeadersQueueType
  Of 'group.Attachments'
    element.Attachments &= NEW AttachmentsQueueType
  End






Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11250
    • View Profile
Re: Processing incoming mail via Postmark
« Reply #1 on: February 28, 2024, 03:07:11 AM »
AttachmentsQueueType      Queue,Type,Name('Attachments')
Name                       STRING(255),Name('Name')
Content                    &StringTheory,Name('Content | StringTheory')
ContentType                STRING(255),Name('ContentType')
ContentLength              Real,Name('ContentLength')
                         End

You don't need to do anything with the length, the StringTheory object will be NEW'd and poplulated for you.

remember to do a
json.DisposeGroup(whatever) at the end of your cod so all the StringTheory objects get disposed.

Cheers
Bruce