WinBatch® Technical Support Forum

All Things WinBatch => WinBatch => Topic started by: atlanta1213 on April 24, 2014, 07:28:05 AM

Title: Postie and Message-ID
Post by: atlanta1213 on April 24, 2014, 07:28:05 AM
Is there a way to set the Message-ID in the mail header when using Postie?
Title: Re: Postie and Message-ID
Post by: Deana on April 24, 2014, 08:18:48 AM
Try appending desired header line to the subject line after a @CRLF. For Example:

Code (winbatch) Select
AddExtender("WWPST44I.DLL")

strSubject="How to add Message-ID header"

; A common technique used by many message systems is to use a time and date stamp along with the local host's domain name, e.g., 950124.162336@example.com
strMsgid = TimeJulianDay( TimeYmdHms() ):'@winbatch.com'
strHeader = "Message-ID:  " : strMsgid
strSubjectHeader = strSubject:@CRLF:strHeader

kInit("mail.sample.com","me@sample.com","","","")
kDest("you@sample.com","","")
bResult = kSendText(strSubjectHeader,"How to add Message-ID header using Postie. Check my header.","","")
If bResult
   Message("Message","Sent")
Else
   Message("Error",kStatusInfo())
EndIf


Reference: http://en.wikipedia.org/wiki/Message-ID
Title: Re: Postie and Message-ID
Post by: atlanta1213 on April 25, 2014, 06:33:55 AM
Thanks so much for that information.  One question though, the message id created (for today) using that method is just the Julian day of 735714. Any tips on how I can get somehting specific down to the second?
Title: Re: Postie and Message-ID
Post by: Deana on April 25, 2014, 07:30:26 AM
Quote from: atlanta1213 on April 25, 2014, 06:33:55 AM
Thanks so much for that information.  One question though, the message id created (for today) using that method is just the Julian day of 735714. Any tips on how I can get somehting specific down to the second?

See TimeYmdhms. Maybe something like:

Code (winbatch) Select
strMsgid = StrReplace( TimeYmdHms(), ':', ''):'@winbatch.com'