|
이 문서는 기계로 번역한 것입니다. 원본 텍스트를 보려면 포인터를 문서의 문장 위로 올리십시오. 추가 정보
|
번역
원본
|
AttachmentCollection 클래스
.NET Framework 4.5
System.Object
System.Collections.ObjectModel.Collection<Attachment>
System.Net.Mail.AttachmentCollection
System.Collections.ObjectModel.Collection<Attachment>
System.Net.Mail.AttachmentCollection
네임스페이스: System.Net.Mail
어셈블리: System(System.dll)
AttachmentCollection 형식에서는 다음과 같은 멤버를 노출합니다.
| 이름 | 설명 | |
|---|---|---|
![]() | Count | |
![]() | Item |
| 이름 | 설명 | |
|---|---|---|
![]() | Add | |
![]() | Clear | |
![]() | Contains | |
![]() | CopyTo | |
![]() | Dispose | |
![]() | Equals(Object) | |
![]() | GetEnumerator | |
![]() | GetHashCode | |
![]() | GetType | |
![]() | IndexOf | |
![]() | Insert | |
![]() | Remove | |
![]() | RemoveAt | |
![]() | ToString |
| 이름 | 설명 | |
|---|---|---|
![]() ![]() | ICollection.CopyTo | |
![]() ![]() | ICollection<T>.IsReadOnly | |
![]() ![]() | ICollection.IsSynchronized | |
![]() ![]() | ICollection.SyncRoot | |
![]() ![]() | IEnumerable.GetEnumerator | |
![]() ![]() | IList.Add | |
![]() ![]() | IList.Contains | |
![]() ![]() | IList.IndexOf | |
![]() ![]() | IList.Insert | |
![]() ![]() | IList.IsFixedSize | |
![]() ![]() | IList.IsReadOnly | |
![]() ![]() | IList.Item | |
![]() ![]() | IList.Remove |
public static void CreateMessageWithAttachment(string server) { // Specify the file to be attached and sent. // This example assumes that a file named Data.xls exists in the // current working directory. string file = "data.xls"; // Create a message and set up the recipients. MailMessage message = new MailMessage( "jane@contoso.com", "ben@contoso.com", "Quarterly data report.", "See the attached spreadsheet."); // Create the file attachment for this e-mail message. Attachment data = new Attachment(file, MediaTypeNames.Application.Octet); // Add time stamp information for the file. ContentDisposition disposition = data.ContentDisposition; disposition.CreationDate = System.IO.File.GetCreationTime(file); disposition.ModificationDate = System.IO.File.GetLastWriteTime(file); disposition.ReadDate = System.IO.File.GetLastAccessTime(file); // Add the file attachment to this e-mail message. message.Attachments.Add(data); //Send the message. SmtpClient client = new SmtpClient(server); // Add credentials if the SMTP server requires them. client.Credentials = CredentialCache.DefaultNetworkCredentials; try { client.Send(message); } catch (Exception ex) { Console.WriteLine("Exception caught in CreateMessageWithAttachment(): {0}", ex.ToString() ); } // Display the values in the ContentDisposition for the attachment. ContentDisposition cd = data.ContentDisposition; Console.WriteLine("Content disposition"); Console.WriteLine(cd.ToString()); Console.WriteLine("File {0}", cd.FileName); Console.WriteLine("Size {0}", cd.Size); Console.WriteLine("Creation {0}", cd.CreationDate); Console.WriteLine("Modification {0}", cd.ModificationDate); Console.WriteLine("Read {0}", cd.ReadDate); Console.WriteLine("Inline {0}", cd.Inline); Console.WriteLine("Parameters: {0}", cd.Parameters.Count); foreach (DictionaryEntry d in cd.Parameters) { Console.WriteLine("{0} = {1}", d.Key, d.Value); } data.Dispose(); }
Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008(서버 코어 역할은 지원되지 않음), Windows Server 2008 R2(서버 코어 역할은 SP1 이상에서 지원, Itanium은 지원되지 않음)
.NET Framework에서 모든 플랫폼의 전체 버전을 지원하지는 않습니다. 지원되는 버전의 목록을 보려면 .NET Framework 시스템 요구 사항을 참조하십시오.

