4D v15

SMTP_Attachment

Home

 
4D v15
SMTP_Attachment

SMTP_Attachment  


 

 

SMTP_Attachment ( smtp_ID ; fileName ; encodeType ; deleteOption {; attachmentID {; contentType}} ) -> Function result

ParameterTypeDescription
smtp_IDLongint->Message reference     
fileNameText->Name of file to attach     
encodeTypeInteger->0 = No encoding (sends DataFork only) ±1 = BinHex ±2 = Base64; (sends DataFork only) ±3 = AppleSingle ±4 = AppleDouble ±5 = AppleSingle AND Base64 ±6 = AppleDouble AND Base64 ±7 = UUEncode     
deleteOptionInteger->0 = Add to existing list, 1 = Replace all attachments with Filename, 2 = Remove only this attachment
attachmentIDText->ID of attachment (HTML messages only)
contentTypeText->Content-type value to set
Function resultInteger<-Error Code

Originally introduced in 4D v14 R4

Theme: IC Send Mail

The SMTP_Attachment command now accepts a new optional contentType parameter, allowing you to set the content type of the attachment file.

By default, if the contentType parameter is omitted or contains an empty string, 4DIC automatically sets the content type of the attachment file based on its extension. The following rules are applied:

ExtensionContent Type
jpg, jpegimage/jpeg
pngimage/png
gifimage/gif
pdfapplication/pdf
docapplication/msword
xlsapplication/vnd.ms-excel
pptapplication/vnd.ms-powerpoint
zipapplication/zip
gzapplication/gzip
jsonapplication/json
jsapplication/javascript
psapplication/postscript
xmlapplication/xml
htm, htmltext/html
mp3audio/mpeg
otherapplication/octet-stream

In contentType, you can now pass a string defining the content type (MIME type) for the file, for example "video/mpeg". This content-type value will be set for the attachment, regardless of its extension.

Note: Pass an empty string ("") in attachmentID if you do not want to use this parameter.

We want to declare your settings files as XML files:

 $path:=Get 4D folder(Database folder)+"Settings.mySettings"
 $err:=SMTP_Attachment($smtp_id;$path;2;0;"myID123";"application/xml")

 
EIGENSCHAFTEN 

Produkt: 4D
Thema: 4D Internet Commands

 
GESCHICHTE 

 
ARTIKELVERWENDUNG

4D v15 - Upgrade (Standard Edition) ( 4D v15)