4D v15SMTP_Attachment |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
4D v15
SMTP_Attachment
|
SMTP_Attachment ( smtp_ID ; fileName ; encodeType ; deleteOption {; attachmentID {; contentType}} ) -> Function result
|
||||||||||||||||||||||||||||||||||
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:
Extension | Content Type |
jpg, jpeg | image/jpeg |
png | image/png |
gif | image/gif |
application/pdf | |
doc | application/msword |
xls | application/vnd.ms-excel |
ppt | application/vnd.ms-powerpoint |
zip | application/zip |
gz | application/gzip |
json | application/json |
js | application/javascript |
ps | application/postscript |
xml | application/xml |
htm, html | text/html |
mp3 | audio/mpeg |
other | application/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")
Product: 4D
Theme: 4D Internet Commands
4D v15 - Upgrade (standard edition) ( 4D v15)