MailMessage.cs 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151
  1. //
  2. // System.Web.Mail.MailMessage.cs
  3. //
  4. // Author:
  5. // Lawrence Pit ([email protected])
  6. // Per Arneng ([email protected])
  7. // Sanjay Gupta ([email protected])
  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. using System.Collections;
  31. using System.Collections.Specialized;
  32. using System.Security.Permissions;
  33. using System.Text;
  34. namespace System.Web.Mail
  35. {
  36. #if NET_2_0
  37. #pragma warning disable 618
  38. #endif
  39. // CAS
  40. [AspNetHostingPermission (SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
  41. [AspNetHostingPermission (SecurityAction.InheritanceDemand, Level = AspNetHostingPermissionLevel.Minimal)]
  42. #if NET_2_0
  43. [Obsolete ("The recommended alternative is System.Net.Mail.MailMessage.")]
  44. #endif
  45. public class MailMessage
  46. {
  47. private ArrayList attachments;
  48. private string bcc;
  49. private string body = String.Empty;
  50. private Encoding bodyEncoding;
  51. private MailFormat bodyFormat;
  52. private string cc;
  53. private string from;
  54. private ListDictionary headers;
  55. private MailPriority priority;
  56. private string subject = String.Empty;
  57. private string to;
  58. private string urlContentBase;
  59. private string urlContentLocation;
  60. // Constructor
  61. public MailMessage ()
  62. {
  63. attachments = new ArrayList (8);
  64. headers = new ListDictionary ();
  65. bodyEncoding = Encoding.Default;
  66. #if NET_1_1
  67. fields = new Hashtable ();
  68. #endif
  69. }
  70. // Properties
  71. public IList Attachments {
  72. get { return (IList) attachments; }
  73. }
  74. public string Bcc {
  75. get { return bcc; }
  76. set { bcc = value; }
  77. }
  78. public string Body {
  79. get { return body; }
  80. set { body = value; }
  81. }
  82. public Encoding BodyEncoding {
  83. get { return bodyEncoding; }
  84. set { bodyEncoding = value; }
  85. }
  86. public MailFormat BodyFormat {
  87. get { return bodyFormat; }
  88. set { bodyFormat = value; }
  89. }
  90. public string Cc {
  91. get { return cc; }
  92. set { cc = value; }
  93. }
  94. public string From {
  95. get { return from; }
  96. set { from = value; }
  97. }
  98. public IDictionary Headers {
  99. get { return (IDictionary) headers; }
  100. }
  101. public MailPriority Priority {
  102. get { return priority; }
  103. set { priority = value; }
  104. }
  105. public string Subject {
  106. get { return subject; }
  107. set { subject = value; }
  108. }
  109. public string To {
  110. get { return to; }
  111. set { to = value; }
  112. }
  113. public string UrlContentBase {
  114. get { return urlContentBase; }
  115. set { urlContentBase = value; }
  116. }
  117. public string UrlContentLocation {
  118. get { return urlContentLocation; }
  119. set { urlContentLocation = value; }
  120. }
  121. #if NET_1_1
  122. private Hashtable fields;
  123. public IDictionary Fields {
  124. get {
  125. return (IDictionary) fields;
  126. }
  127. }
  128. #endif
  129. }
  130. #if NET_2_0
  131. #pragma warning restore 618
  132. #endif
  133. }