MailMessage.cs 3.6 KB

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