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

SMTP Functions

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

How do I send a multi-line message, using smtpSendText?

Keywords: SMTPSendText 

Question:

Is there any way to send multiline message using your SMTPSendText function, or will I have to write my own SMTP sender if I wish to send something longer than 256 Bytes (Max length of string variable)?

Answer:

The String variable length is not limited to 256 - only the length of a line is.

To send a multi-line message, include CRLF,s in the text string.

Note that there is also a smtpSendFile function Example 1:

line="Hello&How are you.&I am fine.&Thank You&goodbye"
line=strreplace(a,"&",@crlf)
Message("Title",line)
Example 2:
a="THis is a long line of text that goes on and on"
b="This is yet another long line of text"
c="And even more text that I know not what to do with"
line=strcat(a,@crlf,b,@crlf,c)
Message("title",line)
You can also send the >line< variable with the SmtpSendText function.

NOTE: If you are using %substitution% which, although handy, is a BAD way to handle large strings, watch out that you don't exceed the 256 line length limit after substitution. Useful code below:

;AddExtender("WWWNT34I.DLL")
AddExtender("WWWSK34I.DLL")
IntControl (12, 6,"" , 0, 0)
;MAILRELAY=Param1
;FROM=Param2
;TO=Param3
;SUBJECT=Param4
;FILE=Param5
MAILRELAY="craft"
FROM="nisse"
TILL="lhpc"
SUBJECT="Urk på burk"
FILE="boot.ini"
MSG=""
Message("",strcat(MAILRELAY," ",FROM," ",TILL," ",SUBJECT," ",FILE))
;;;;;;;;;;;;;;;;;;;;

HANDLE=FileOpen(FILE,"read")
RAD=FileRead(HANDLE)
While RAD <> "*EOF*"
message("",RAD)

MSG=strcat(MSG,@CRLF,RAD);;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  RAD=FileRead(HANDLE)
  EndWhile
  FileClose(HANDLE)

SMTPSendText (MAILRELAY, FROM, TILL, SUBJECT, MSG)

exit

Article ID:   W12682
Filename:   SMTPSendText and 256K line limit.txt
File Created: 2001:03:01:15:05:18
Last Updated: 2001:03:01:15:05:18