MailMessage.cs 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156
  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. // (c)2004 Novell, Inc. (http://www.novell.com)
  10. //
  11. //
  12. // Permission is hereby granted, free of charge, to any person obtaining
  13. // a copy of this software and associated documentation files (the
  14. // "Software"), to deal in the Software without restriction, including
  15. // without limitation the rights to use, copy, modify, merge, publish,
  16. // distribute, sublicense, and/or sell copies of the Software, and to
  17. // permit persons to whom the Software is furnished to do so, subject to
  18. // the following conditions:
  19. //
  20. // The above copyright notice and this permission notice shall be
  21. // included in all copies or substantial portions of the Software.
  22. //
  23. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  24. // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  25. // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
  26. // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
  27. // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
  28. // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
  29. // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  30. //
  31. using System;
  32. using System.Collections;
  33. using System.Collections.Specialized;
  34. using System.Text;
  35. namespace System.Web.Mail
  36. {
  37. /// <remarks>
  38. /// </remarks>
  39. public class MailMessage
  40. {
  41. private ArrayList attachments;
  42. private string bcc;
  43. private string body = "";
  44. private Encoding bodyEncoding;
  45. private MailFormat bodyFormat;
  46. private string cc;
  47. private string from;
  48. private ListDictionary headers;
  49. private MailPriority priority;
  50. private string subject = "";
  51. private string to;
  52. private string urlContentBase;
  53. private string urlContentLocation;
  54. // Constructor
  55. public MailMessage ()
  56. {
  57. attachments = new ArrayList (8);
  58. headers = new ListDictionary ();
  59. bodyEncoding = Encoding.Default;
  60. #if NET_1_1
  61. fields = new Hashtable ();
  62. #endif
  63. #if NET_2_0
  64. bodyParts = new ArrayList (2);
  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. #if NET_2_0
  127. private ArrayList bodyParts;
  128. public IList RelatedBodyParts {
  129. get { return (IList) bodyParts; }
  130. }
  131. #endif
  132. }
  133. } //namespace System.Web.Mail