1 // Copyright 2004-2008 Castle Project - http://www.castleproject.org/
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
7 // http://www.apache.org/licenses/LICENSE-2.0
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
15 namespace Castle
.Components
.Common
.EmailSender
18 using System
.Collections
.Generic
;
20 using System
.Net
.Mail
;
22 using System
.Collections
;
23 using System
.Collections
.Specialized
;
31 /// The body is composed of html content
35 /// The body is pure text
43 public enum MessagePriority
51 /// Abstracts an e-mail message
60 private String subject
;
61 private Format format
= Format
.Text
;
62 private Encoding encoding
= Encoding
.ASCII
;
63 private IDictionary headers
= new HybridDictionary();
64 private IDictionary fields
= new HybridDictionary();
65 private MessagePriority priority
= MessagePriority
.Normal
;
66 private MessageAttachmentCollection attachments
= new MessageAttachmentCollection();
67 private readonly IDictionary
<string, LinkedResource
> linkedResources
= new Dictionary
<string, LinkedResource
>();
70 /// Initializes a new instance of the <see cref="Message"/> class.
77 /// Initializes a new instance of the <see cref="Message"/> class.
79 /// <param name="from">From header.</param>
80 /// <param name="to">To header.</param>
81 /// <param name="subject">The subject header.</param>
82 /// <param name="body">The message body.</param>
83 public Message(string from, string to
, string subject
, string body
)
88 this.subject
= subject
;
100 set { from = value; }
118 set { body = value; }
121 public String Subject
123 get { return subject; }
124 set { subject = value; }
129 get { return format; }
130 set { format = value; }
133 public Encoding Encoding
135 get { return encoding; }
136 set { encoding = value; }
139 public MessagePriority Priority
141 get { return priority; }
142 set { priority = value; }
145 public IDictionary Headers
147 get { return headers; }
150 public IDictionary Fields
152 get { return fields; }
155 public MessageAttachmentCollection Attachments
157 get { return attachments; }
160 public IDictionary
<string, LinkedResource
> Resources
162 get { return linkedResources; }