Merge pull request #347 from JamesB7/master
[mono.git] / mcs / class / System.Web / System.Web.Mail / MailMessage.cs
1 //
2 // System.Web.Mail.MailMessage.cs
3 //
4 // Author:
5 //    Lawrence Pit (loz@cable.a2000.nl)
6 //    Per Arneng (pt99par@student.bth.se)
7 //      Sanjay Gupta (gsanjay@novell.com)
8 //
9 // Copyright (C) 2004-2005 Novell, Inc (http://www.novell.com)
10 //
11 // Permission is hereby granted, free of charge, to any person obtaining
12 // a copy of this software and associated documentation files (the
13 // "Software"), to deal in the Software without restriction, including
14 // without limitation the rights to use, copy, modify, merge, publish,
15 // distribute, sublicense, and/or sell copies of the Software, and to
16 // permit persons to whom the Software is furnished to do so, subject to
17 // the following conditions:
18 // 
19 // The above copyright notice and this permission notice shall be
20 // included in all copies or substantial portions of the Software.
21 // 
22 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
23 // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
24 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
25 // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
26 // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
27 // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
28 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
29 //
30
31 using System.Collections;
32 using System.Collections.Specialized;
33 using System.Security.Permissions;
34 using System.Text;
35
36 namespace System.Web.Mail
37 {
38 #if !NET_4_0
39         // CAS
40         [AspNetHostingPermission (SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
41         [AspNetHostingPermission (SecurityAction.InheritanceDemand, Level = AspNetHostingPermissionLevel.Minimal)]
42 #endif
43         [Obsolete ("The recommended alternative is System.Net.Mail.MailMessage. http://go.microsoft.com/fwlink/?linkid=14202")]
44         public class MailMessage
45         {
46                 ArrayList attachments;
47                 string bcc;
48                 string body = String.Empty;
49                 Encoding bodyEncoding;
50                 MailFormat bodyFormat;
51                 string cc;              
52                 string from;
53                 ListDictionary headers;
54                 MailPriority priority;
55                 string subject = String.Empty;
56                 string to;
57                 string urlContentBase;
58                 string urlContentLocation;
59                 
60                 // Constructor          
61                 public MailMessage ()
62                 {
63                         attachments = new ArrayList (8);
64                         headers = new ListDictionary ();
65                         bodyEncoding = Encoding.Default;
66                         fields = new Hashtable ();
67                 }               
68         
69                 // Properties
70                 public IList Attachments {
71                         get { return (IList) attachments; }
72                 }               
73                 
74                 public string Bcc {
75                         get { return bcc; } 
76                         set { bcc = value; }
77                 }
78         
79                 public string Body {
80                         get { return body; } 
81                         set { body = value; }
82                 }
83
84                 public Encoding BodyEncoding {
85                         get { return bodyEncoding; } 
86                         set { bodyEncoding = value; }
87                 }
88
89                 public MailFormat BodyFormat {
90                         get { return bodyFormat; } 
91                         set { bodyFormat = value; }
92                 }               
93
94                 public string Cc {
95                         get { return cc; } 
96                         set { cc = value; }
97                 }
98
99                 public string From {
100                         get { return from; } 
101                         set { from = value; }
102                 }
103
104                 public IDictionary Headers {
105                         get { return (IDictionary) headers; }
106                 }
107                 
108                 public MailPriority Priority {
109                         get { return priority; } 
110                         set { priority = value; }
111                 }
112                 
113                 public string Subject {
114                         get { return subject; } 
115                         set { subject = value; }
116                 }
117
118                 public string To {
119                         get { return to; }   
120                         set { to = value; }
121                 }
122
123                 public string UrlContentBase {
124                         get { return urlContentBase; } 
125                         set { urlContentBase = value; }
126                 }
127
128                 public string UrlContentLocation {
129                         get { return urlContentLocation; } 
130                         set { urlContentLocation = value; }
131                 }
132
133                 Hashtable fields;
134                 
135                 public IDictionary Fields {
136                         get {
137                                 return (IDictionary) fields;
138                         }
139                 }
140         }
141 }