Version 6.5.x and 6.7.x
Since 4D Write stores text in its own format, you must extract pure text out of the document before pasting it into your e-mail body. The example below extracts text from a 4D Write document stored in a picture field and pastes it in an e-mail body.
ALL RECORDS([Table 1]) `Selecting all Records
For(i;1;Records in selection([table 1])) `Loop through all records
Temp:=WR New offscreen area `Creating an offscreen area
WR PICTURE TO AREA (Temp;[Table 1]Doc_) `Placing template in offscreen area
vText:=WR Get text (Temp;0;25) `Grabbing the first 25 characters in the area Temp
WR DELETE OFFSCREEN AREA (Temp) `Deleting the offscreen area
$error:=SMTP_New ($smtp_id)
$error:=SMTP_Host ($smtp_id;"mymailhost.com")
$error:=SMTP_From ($smtp_id;"someone@somewhere.com")
$error:=SMTP_Subject ($smtp_id;"Discounts on Ad Space!")
$error:=SMTP_To ($smtp_id;"someone@outthere.com";1) `Replace the "To" header with new value
$error:=SMTP_Body ($smtp_id;vText) `Placing the text into the body
$error:=SMTP_Send ($smtp_id)
Next Record([Table 1])
End for