Saltar para o conteúdo principal
Versão: 20 R7

MailAttachment

Os objetos Attachment permitem fazer referência a arquivos em um objeto Email. Os objetos Attachment são criados usando o comando MAIL New attachment.

Objeto anexos

Objetos anexos oferecem as propriedades e funções apenas leitura abaixo:

.cid : Text
.disposition : Text
o valor do cabeçalho `Content-Disposition
.getContent() : 4D.Blob
returns the contents of the attachment object in a 4D.Blob object
.name : Text
o nome e a extensão do anexo
.path : Text
o caminho POSIX do arquivo de anexo, se ele existir
.platformPath : Text
the path of the attachment file expressed with the current platform syntax
.size : Integer
the value of the size header of the attachment file
.type : Text
o content-type do arquivo anexo

4D. MailAttachment.new()

História
ReleaseMudanças
19 R2Accepts 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

ParâmetroTipoDescrição
file4D. File->Parâmetros
zipFile4D. ZipFile->Arquivo zip
blob4D. Blob->Blob contendo o anexo
pathText->Pode passar uma rota ou um Blob para definir o anexo.
nameText->Nome + extensão usado pelo cliente email para designar o anexo
cidText->ID do anexo (apenas mensagens HTML), ou " " se nenhum cid for exigido
typeText->Valor do cabeçalho content-type
dispositionText->Valor do cabeçalho content-disposition: "inline" ou "attachment".
Resultados4D. MailAttachment<-Objeto anexo

Descrição

The 4D.MailAttachment.new() function creates and returns a new object of the 4D.MailAttachment type. Ele é idêntico ao comando MAIL New attachment (atalho).

.cid

.cid : Text

Descrição

A propriedade .cid contém o ID do anexo. Essa funcionalidade é usada em mensagens HTML apenas. Se essa propriedade faltar, o arquivo é manejado como um anexo simples (link).

.disposition

.disposition : Text

Descrição

A propriedade .disposition contém o valor do cabeçalho `Content-Disposition. Dois valores esetão disponíveis:

  • "inline": o anexo é renderizado dentro dos conteúdos da mensagem, no local "cid". A renderização depende do cliente mail.
  • "attachment": o anexo é fornecido como um link na mensagem.

.getContent()

.getContent() : 4D.Blob

ParâmetroTipoDescrição
Resultados4D. Blob<-Conteúdo do anexo

Descrição

The .getContent() function returns the contents of the attachment object in a 4D.Blob object. Você pode usar esse método com objetos de anexo recebidos pelo comando MAIL Convert from MIME.

.name

.name : Text

Descrição

A propriedade .name contém o nome e a extensão do anexo. By default, it is the name of the file, unless another name was specified in the MAIL New attachment command.

.path

.path : Text

Descrição

A propriedade .path contém o caminho POSIX do arquivo de anexo, se ele existir.

.platformPath

História
ReleaseMudanças
19Adicionado

.platformPath : Text

Descrição

The .platformPath property returns the path of the attachment file expressed with the current platform syntax.

.size

.size : Integer

Descrição

The .size property contains the value of the size header of the attachment file. The .size property is returned when the MIME message defines a size header in the attachment part.

.type

.type : Text

Descrição

A propriedade .type contém o content-type do arquivo anexo. If this type is not explicitly passed to the MAIL New attachment command, the content-type is based on its file extension.