DispositionTypeNames 클래스

정의

이메일 첨부 파일의 처리 유형을 지정하는 데 사용되는 문자열을 지정합니다.

public ref class DispositionTypeNames abstract sealed
public static class DispositionTypeNames
type DispositionTypeNames = class
Public Class DispositionTypeNames
상속
DispositionTypeNames

예제

다음 코드 예제에서는 첨부 파일의 처리 유형을 설정합니다.

static void CreateMessageInlineAttachment3( 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->DispositionType = DispositionTypeNames::Inline;
   
   //Send the message.
   // Include credentials if the server requires them.
   SmtpClient^ client = gcnew SmtpClient( server );
   client->Credentials = dynamic_cast<ICredentialsByHost^>(CredentialCache::DefaultNetworkCredentials);
   client->Send( message );
   data->~Attachment();
   client->~SmtpClient();
}
public static void CreateMessageInlineAttachment3(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.DispositionType = DispositionTypeNames.Inline;
    //Send the message.
    // Include credentials if the server requires them.
    SmtpClient client = new SmtpClient(server);
    client.Credentials = (ICredentialsByHost)CredentialCache.DefaultNetworkCredentials;
    client.Send(message);
    data.Dispose();
}

설명

이 열거형의 값을 사용하여 전자 메일 첨부 파일의 DispositionType 속성을 설정할 수 있습니다. 클래스의 ContentDisposition 정보는 MIME Content-Disposition 헤더를 나타냅니다. 이 헤더는 에서 사용할 수 있는 RFC 2183에 https://www.ietf.org설명되어 있습니다.

필드

Attachment

첨부 파일이 이메일 메시지에 첨부된 파일로 표시되도록 지정합니다.

Inline

첨부 파일이 이메일 메시지 본문의 일부로 표시되도록 지정합니다.

적용 대상

추가 정보