WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

Postie

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

Is kGetMail Converting File Endings?

Keywords: 

Question:

I'm having a problem with Postie changing the file as it is retrieved via kGetMail.

Here is my code:

  AddExtender("WWPST34I.DLL")

  host="mail.domain.com"
  fromaddr="pospay@domain.com"
  userid="pospay"
  password="password"
  port=""
  msgnumber=""
  extractfile=""
  mailbox=""
  flags=""

  kInit(host,fromaddr,userid,password,port)
  mymail=kGetMail(msgnumber,extractfile,strcat(""),mailbox,flags)
I do a few file copies and then execute these lines to delete the messages:
   Flags="d"
   mymail=kGetMail(msgnumber,extractfile,strcat(""),mailbox,flags)
Everything looked fine until I tried to use the file. It appears to change the original file. Here are the two files:

If you notice the original file is 13.9 K and the postie file is 11.6 K. Whatever postie does to the file makes it unusable for my purposes. Am I doing something wrong? Is there a parameter that I am missing in my code?

Answer:

It looks like Postie has decided to convert CRLFs to LFs.
  1. Maybe specify the "t" option.

    I suspect that the sending PC is a MAC, and Postie, by default write the attahcment in "binary" mode - basically meaning "as send". Macs don't use LF's.

    By specifying the "t" option you can request translation of CR to CRLF which is what you seem to want.

  2. You could run the file through the following processor:
    dafile="c:\temp\postie.fil"
    fs=Filesize(dafile)
    binbuf=BinaryAlloc(fs+2500)
    str=@lf
    newstr=@crlf
    
    ret = BinaryRead( binbuf, dafile )
    num = BinaryReplace( binbuf, str, newstr ,0)
    Message( "Number of '%str%' strings replaced", num )
    BinaryWrite( binbuf, dafile )
    

Article ID:   W14432
Filename:   kGetMail Converting File Endings.txt
File Created: 2017:07:28:12:58:35
Last Updated: 2001:08:30:09:52:58