2
0

MailMessage.cs 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  1. //
  2. // System.Web.Mail.MailMessage.cs
  3. //
  4. // Author:
  5. // Lawrence Pit ([email protected])
  6. // Per Arneng ([email protected])
  7. //
  8. //
  9. // Permission is hereby granted, free of charge, to any person obtaining
  10. // a copy of this software and associated documentation files (the
  11. // "Software"), to deal in the Software without restriction, including
  12. // without limitation the rights to use, copy, modify, merge, publish,
  13. // distribute, sublicense, and/or sell copies of the Software, and to
  14. // permit persons to whom the Software is furnished to do so, subject to
  15. // the following conditions:
  16. //
  17. // The above copyright notice and this permission notice shall be
  18. // included in all copies or substantial portions of the Software.
  19. //
  20. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  21. // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  22. // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
  23. // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
  24. // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
  25. // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
  26. // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  27. //
  28. using System;
  29. using System.Collections;
  30. using System.Collections.Specialized;
  31. using System.Text;
  32. namespace System.Web.Mail
  33. {
  34. /// <remarks>
  35. /// </remarks>
  36. public class MailMessage
  37. {
  38. private ArrayList attachments;
  39. private string bcc;
  40. private string body = "";
  41. private Encoding bodyEncoding;
  42. private MailFormat bodyFormat;
  43. private string cc;
  44. private string from;
  45. private ListDictionary headers;
  46. private MailPriority priority;
  47. private string subject = "";
  48. private string to;
  49. private string urlContentBase;
  50. private string urlContentLocation;
  51. private Hashtable fields;
  52. // Constructor
  53. public MailMessage ()
  54. {
  55. attachments = new ArrayList (8);
  56. headers = new ListDictionary ();
  57. bodyEncoding = Encoding.Default;
  58. fields = new Hashtable ();
  59. }
  60. // Properties
  61. public IList Attachments {
  62. get { return (IList) attachments; }
  63. }
  64. public string Bcc {
  65. get { return bcc; }
  66. set { bcc = value; }
  67. }
  68. public string Body {
  69. get { return body; }
  70. set { body = value; }
  71. }
  72. public Encoding BodyEncoding {
  73. get { return bodyEncoding; }
  74. set { bodyEncoding = value; }
  75. }
  76. public MailFormat BodyFormat {
  77. get { return bodyFormat; }
  78. set { bodyFormat = value; }
  79. }
  80. public string Cc {
  81. get { return cc; }
  82. set { cc = value; }
  83. }
  84. public string From {
  85. get { return from; }
  86. set { from = value; }
  87. }
  88. public IDictionary Headers {
  89. get { return (IDictionary) headers; }
  90. }
  91. public MailPriority Priority {
  92. get { return priority; }
  93. set { priority = value; }
  94. }
  95. public string Subject {
  96. get { return subject; }
  97. set { subject = value; }
  98. }
  99. public string To {
  100. get { return to; }
  101. set { to = value; }
  102. }
  103. public string UrlContentBase {
  104. get { return urlContentBase; }
  105. set { urlContentBase = value; }
  106. }
  107. public string UrlContentLocation {
  108. get { return urlContentLocation; }
  109. set { urlContentLocation = value; }
  110. }
  111. #if NET_1_1
  112. public IDictionary Fields {
  113. get {
  114. return (IDictionary) fields;
  115. }
  116. }
  117. #endif
  118. }
  119. } //namespace System.Web.Mail