MailAttachment
Attachment オブジェクトによって、Email オブジェクト内のファイルを参照することができます。 MailAttachment オブジェクトは MAIL New attachment コマンドによって作成されます。
Attachment オブジェクト
Attachment オブジェクトは、次の読み取り専用プロパティや、関数を提供します:
4D.MailAttachment.new()
履歴
| リリース | 内容 | 
|---|---|
| 19 R2 | 4D.File, 4D.ZipFile, 4D.Blob の受け入れ | 
4D.MailAttachment.new*( file : 4D.File { ; name : Text {; cid : Text{ ; type : Text { ; disposition :Text } } } } ) : 4D.MailAttachment
4D.MailAttachment.new( zipFile : 4D.ZipFile { ; name : Text {; cid : Text{ ; type : Text { ; disposition :Text } } } } ) : 4D.MailAttachment
4D.MailAttachment.new( blob : 4D.Blob { ; name : Text {; cid : Text{ ; type : Text { ; disposition :Text } } } } ) : 4D.MailAttachment
4D.MailAttachment.new( path : Text { ; name : Text {; cid : Text{ ; type : Text { ; disposition :Text } } } } ) : 4D.MailAttachment
| 引数 | 型 | 説明 | |
|---|---|---|---|
| file | 4D.File | -> | 添付ファイル | 
| zipFile | 4D.ZipFile | -> | 添付 Zipファイル | 
| blob | 4D.Blob | -> | 添付を格納した BLOB | 
| path | Text | -> | 添付ファイルのパス | 
| name | Text | -> | メールクライアントが添付を指定するのに使用する名前 + 拡張子 | 
| cid | Text | -> | 添付の ID (HTMLメッセージのみ)、あるいは cid が不要な場合は "" (空の文字列) | 
| type | Text | -> | content-type ヘッダーの値 | 
| disposition | Text | -> | content-disposition ヘッダーの値: "inline" あるいは "attachment" | 
| 戻り値 | 4D.MailAttachment | <- | Attachment オブジェクト | 
説明
4D.MailAttachment.new() 関数は、4D.MailAttachment 型の新規オブジェクト作成して返します。 この関数の機能は、MAIL New attachment コマンドと同一です。
.cid
.cid* : Text
説明
.cid プロパティは、  添付ファイルの IDを格納します。 このプロパティは HTMLメッセージでのみ使用されます。 このプロパティがない場合、ファイルは単なる添付 (リンク) として管理されます。
.disposition
.disposition* : Text
説明
.disposition プロパティは、Content-Disposition ヘッダーの値を格納します。 二つの値が利用可能です:
- "inline": 添付ファイルはメッセージコンテンツ内に、"cid"の場所にレンダリングされます。 レンダリングの結果はメールクライアントによって異なります。
- "attachment": 添付ファイルはメッセージ内でリンクとして提供されます。
.getContent()
.getContent()* : 4D.Blob
| 引数 | 型 | 説明 | |
|---|---|---|---|
| 戻り値 | 4D.Blob | <- | 添付の中身 | 
説明
.getContent() 関数は、 添付オブジェクトの中身を 4D.Blob オブジェクトとして返します。 MAIL Convert from MIME コマンドによって取得した添付オブジェクトに対して、この関数を使用することができます。
.name
.name* : Text
説明
.name プロパティは、添付ファイルの名前と拡張子を格納します。  MAIL New attachment コマンドで別の名称を指定しなかった場合のデフォルトは、ファイルの名称です。
.path
.path* : Text
説明
.path プロパティは、添付ファイルの POSIXパス(存在すれば) を格納します。
.platformPath
履歴
| リリース | 内容 | 
|---|---|
| 19 | 追加 | 
.platformPath* : Text
説明
.platformPath プロパティは、カレントプラットフォームのシンタックスで表現されたファイルのパスを返します。
.size
.size* : Integer
説明
.size プロパティは、添付ファイルの size ヘッダーを格納します。 .sizeプロパティは、MIMEメッセージが添付ファイル部でサイズヘッダーを定義している場合に返されます。
.type
.type* : Text
説明
.type プロパティは、添付ファイルの content-type を格納します。 MAIL New attachment コマンドにて、このタイプが明示的に渡されていない場合、content-type はファイルの拡張子に基づきます。