ContentDisposition.Inline 속성

정의

이메일 첨부 파일의 처리 유형(Inline 또는 Attachment)을 결정하는 Boolean 값을 가져오거나 설정합니다.

public:
 property bool Inline { bool get(); void set(bool value); };
public bool Inline { get; set; }
member this.Inline : bool with get, set
Public Property Inline As Boolean

속성 값

true 첨부 파일의 콘텐츠가 전자 메일 본문의 일부로 인라인으로 표시되면 이고, 그렇지 않으면 입니다 false.

예제

다음 코드 예제에서는이 속성의 값을 설정 하는 방법을 보여 줍니다.

static void CreateMessageInlineAttachment( String^ server, String^ textMessage )
{
   
   // Create a message and set up the recipients.
   MailMessage^ message = gcnew MailMessage( L"jane@contoso.com",L"ben@contoso.com",L"An inline text message for you.",L"Message: " );
   
   // Attach the message string to this email message.
   Attachment^ data = gcnew Attachment( textMessage,MediaTypeNames::Text::Plain );
   
   // Send textMessage as part of the email body.
   message->Attachments->Add( data );
   ContentDisposition^ disposition = data->ContentDisposition;
   disposition->Inline = true;
   
   //Send the message.
   // Include credentials if the server requires them.
   SmtpClient^ client = gcnew SmtpClient( server );
   client->Credentials = CredentialCache::DefaultNetworkCredentials;
   client->Send( message );
   data->~Attachment();
   client->~SmtpClient();
}
public static void CreateMessageInlineAttachment(string server, string
textMessage)
{
    // Create a message and set up the recipients.
    MailMessage message = new MailMessage(
       "jane@contoso.com",
       "ben@contoso.com",
       "An inline text message for you.",
       "Message: ");

    // Attach the message string to this email message.
    Attachment data = new Attachment(textMessage, MediaTypeNames.Text.Plain);
    // Send textMessage as part of the email body.
    message.Attachments.Add(data);
    ContentDisposition disposition = data.ContentDisposition;
    disposition.Inline = true;
    //Send the message.
    // Include credentials if the server requires them.
    SmtpClient client = new SmtpClient(server);
    client.Credentials = CredentialCache.DefaultNetworkCredentials;

    try
    {
        client.Send(message);
    }
    catch (Exception ex)
    {
        Console.WriteLine("Exception caught in CreateMessageInlineAttachment: {0}",
            ex.ToString());
    }
    data.Dispose();
}

설명

속성은 Inline 전자 메일 메시지와 함께 전송된 Content-Disposition 헤더의 처리 유형을 설정합니다. 처리 유형은 전자 메일을 표시하는 소프트웨어에서 전자 메일 첨부 파일을 표시하는 올바른 방법을 결정하는 데 사용할 수 있습니다. 처리 유형이 인 DispositionTypeNames.Inline 첨부 파일은 일반적으로 사용자가 전자 메일을 열 때 표시됩니다. 처리 유형이 인 DispositionTypeNames.Attachment 첨부 파일은 일반적으로 사용자가 첨부 파일을 나타내는 아이콘을 클릭하는 등의 추가 작업을 수행할 때까지 열리지 않습니다.

Content-Disposition 헤더는 에서 사용할 수 있는 RFC 2183에 https://www.ietf.org설명되어 있습니다.

적용 대상