I grabbed this code from another topic on this forum and it has allowed me to send email through NAS. Now I need a little more info on SMTP. How do I add more than 1 line to the textbody of the email? Also what are the limits on the lengths of ObjectEmail.Subject + ObjectEmail.TextBody. IF ISCLEAR(ObjEmail) THEN CREATE(ObjEmail); ObjEmail.Configuration := ObjEmailConf; ObjEmail.From := ‘email@example.com’; ObjEmail.“To” := PassJobScheduler.“Email 1”; IF JobScheduler.“CC Email 1” <> ‘’ THEN ObjEmail.CC := JobScheduler.“CC Email 1”; ObjEmail.Subject := Subject; ObjEmail.TextBody := BodyMessage; ObjEmail.Send;
To create more lines of body: Create a variable “crlf” of type Text, Length = 2. Set values like this: crlf := 13; crlf := 10; Then: ObjEmail.TextBody := BodyMessage + crlf + BodyMessage2; I am not aware of any limits of a mail body, but Navision (current version) can handle only strings of length 1024.
The only limitations are 1) Subject should not have a newline ie, carriage return & line feed chars. Otherwise your subject will be truncated upto the new line 2) No limitations on body until you are using text type. 3) If you want to send email with body other then text - include appropriate content types eg. for html - text/html 4) If you are adding any attachments - should confirm to MIME standards simple search in google will give you different RFC standards - such that you can leverage mail as per your need. -John
Hi! It also depends on which SMTP component you use! E.g. the OCX components you’ll find at MIBUSO http://www.mibuso.com/dlinfo.asp?FileID=366 or http://www.mibuso.com/dlinfo.asp?FileID=112 provide a method “AddLine” - there you can add as many lines to the body as you want (IMO 250 chars per line - not sure about this). Regards, Jörg