Imported Upstream version 3.6.0

Former-commit-id: da6be194a6b1221998fc28233f2503bd61dd9d14
This commit is contained in:
Jo Shields
2014-08-13 10:39:27 +01:00
commit a575963da9
50588 changed files with 8155799 additions and 0 deletions

View File

@@ -0,0 +1,139 @@
//
// System.Net.Mail.AlternateView.cs
//
// Author:
// John Luke (john.luke@gmail.com)
//
// Copyright (C) John Luke, 2005
//
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System.IO;
using System.Net.Mime;
using System.Text;
namespace System.Net.Mail {
public class AlternateView : AttachmentBase
{
#region Fields
Uri baseUri;
LinkedResourceCollection linkedResources = new LinkedResourceCollection ();
#endregion // Fields
#region Constructors
public AlternateView (string fileName) : base (fileName)
{
if (fileName == null)
throw new ArgumentNullException ();
}
public AlternateView (string fileName, ContentType contentType) : base (fileName, contentType)
{
if (fileName == null)
throw new ArgumentNullException ();
}
public AlternateView (string fileName, string mediaType) : base (fileName, mediaType)
{
if (fileName == null)
throw new ArgumentNullException ();
}
public AlternateView (Stream contentStream) : base (contentStream)
{
}
public AlternateView (Stream contentStream, string mediaType) : base (contentStream, mediaType)
{
}
public AlternateView (Stream contentStream, ContentType contentType) : base (contentStream, contentType)
{
}
#endregion // Constructors
#region Properties
#endregion // Properties
public Uri BaseUri {
get { return baseUri; }
set { baseUri = value; }
}
public LinkedResourceCollection LinkedResources {
get { return linkedResources; }
}
#region Methods
public static AlternateView CreateAlternateViewFromString (string content)
{
if (content == null)
throw new ArgumentNullException ();
MemoryStream ms = new MemoryStream (Encoding.UTF8.GetBytes (content));
AlternateView av = new AlternateView (ms);
av.TransferEncoding = TransferEncoding.QuotedPrintable;
return av;
}
public static AlternateView CreateAlternateViewFromString (string content, ContentType contentType)
{
if (content == null)
throw new ArgumentNullException ("content");
Encoding enc = contentType.CharSet != null ? Encoding.GetEncoding (contentType.CharSet) : Encoding.UTF8;
MemoryStream ms = new MemoryStream (enc.GetBytes (content));
AlternateView av = new AlternateView (ms, contentType);
av.TransferEncoding = TransferEncoding.QuotedPrintable;
return av;
}
public static AlternateView CreateAlternateViewFromString (string content, Encoding encoding, string mediaType)
{
if (content == null)
throw new ArgumentNullException ("content");
if (encoding == null)
encoding = Encoding.UTF8;
MemoryStream ms = new MemoryStream (encoding.GetBytes (content));
ContentType ct = new ContentType ();
ct.MediaType = mediaType;
ct.CharSet = encoding.HeaderName;
AlternateView av = new AlternateView (ms, ct);
av.TransferEncoding = TransferEncoding.QuotedPrintable;
return av;
}
protected override void Dispose (bool disposing)
{
if (disposing)
foreach (LinkedResource lr in linkedResources)
lr.Dispose ();
base.Dispose (disposing);
}
#endregion // Methods
}
}

View File

@@ -0,0 +1,82 @@
//
// System.Net.Mail.AlternateViewCollection.cs
//
// Author:
// John Luke (john.luke@gmail.com)
//
// Copyright (C) John Luke, 2005
//
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System.Collections.ObjectModel;
using System.Net.Mime;
namespace System.Net.Mail {
public sealed class AlternateViewCollection : Collection<AlternateView>, IDisposable
{
#region Fields
#endregion // Fields
#region Constructors
internal AlternateViewCollection ()
{
}
#endregion // Constructors
#region Properties
#endregion // Properties
#region Methods
public void Dispose ()
{
}
protected override void ClearItems ()
{
base.ClearItems ();
}
protected override void InsertItem (int index, AlternateView item)
{
base.InsertItem (index, item);
}
protected override void RemoveItem (int index)
{
base.RemoveItem (index);
}
protected override void SetItem (int index, AlternateView item)
{
base.SetItem (index, item);
}
#endregion // Methods
}
}

View File

@@ -0,0 +1,156 @@
//
// System.Net.Mail.Attachment.cs
//
// Author:
// Tim Coleman (tim@timcoleman.com)
//
// Copyright (C) Tim Coleman, 2004
//
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System.IO;
using System.Net.Mime;
using System.Text;
namespace System.Net.Mail {
public class Attachment : AttachmentBase
{
#region Fields
ContentDisposition contentDisposition = new ContentDisposition ();
Encoding nameEncoding;
#endregion // Fields
#region Constructors
public Attachment (string fileName)
: base (fileName) {
InitName (fileName);
}
public Attachment (string fileName, string mediaType)
: base (fileName, mediaType) {
InitName (fileName);
}
public Attachment (string fileName, ContentType contentType)
: base (fileName, contentType) {
InitName (fileName);
}
public Attachment (Stream contentStream, ContentType contentType)
: base (contentStream, contentType) {
}
public Attachment (Stream contentStream, string name)
: base (contentStream) {
Name = name;
}
public Attachment (Stream contentStream, string name, string mediaType)
: base (contentStream, mediaType) {
Name = name;
}
#endregion // Constructors
#region Properties
public ContentDisposition ContentDisposition {
get { return contentDisposition; }
}
public string Name {
get { return ContentType.Name; }
set { ContentType.Name = value; }
}
public Encoding NameEncoding {
get { return nameEncoding; }
set { nameEncoding = value; }
}
#endregion // Properties
#region Methods
public static Attachment CreateAttachmentFromString (string content, ContentType contentType)
{
if (content == null)
throw new ArgumentNullException ("content");
MemoryStream ms = new MemoryStream ();
StreamWriter sw = new StreamWriter (ms);
sw.Write (content);
sw.Flush ();
ms.Position = 0;
Attachment a = new Attachment (ms, contentType);
a.TransferEncoding = TransferEncoding.QuotedPrintable;
return a;
}
public static Attachment CreateAttachmentFromString (string content, string name)
{
if (content == null)
throw new ArgumentNullException ("content");
MemoryStream ms = new MemoryStream ();
StreamWriter sw = new StreamWriter (ms);
sw.Write (content);
sw.Flush ();
ms.Position = 0;
Attachment a = new Attachment (ms, new ContentType ("text/plain"));
a.TransferEncoding = TransferEncoding.QuotedPrintable;
a.Name = name;
return a;
}
public static Attachment CreateAttachmentFromString (string content, string name, Encoding contentEncoding, string mediaType)
{
if (content == null)
throw new ArgumentNullException ("content");
MemoryStream ms = new MemoryStream ();
StreamWriter sw = new StreamWriter (ms, contentEncoding);
sw.Write (content);
sw.Flush ();
ms.Position = 0;
Attachment a = new Attachment (ms, name, mediaType);
a.TransferEncoding = ContentType.GuessTransferEncoding (contentEncoding);
a.ContentType.CharSet = sw.Encoding.BodyName;
return a;
}
#endregion // Methods
private void InitName (string fileName) {
if (fileName == null) {
throw new ArgumentNullException ("fileName");
}
Name = Path.GetFileName (fileName);
}
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,69 @@
//
// System.Net.Mail.AttachmentCollection.cs
//
// Author:
// Tim Coleman (tim@timcoleman.com)
//
// Copyright (C) Tim Coleman, 2004
//
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
using System.Collections.ObjectModel;
using System.Collections.Generic;
namespace System.Net.Mail {
public sealed class AttachmentCollection : Collection<Attachment>, IDisposable
{
internal AttachmentCollection ()
{
}
public void Dispose ()
{
for (int i = 0; i < Count; i += 1)
this [i].Dispose ();
}
protected override void ClearItems ()
{
base.ClearItems ();
}
protected override void InsertItem (int index, Attachment item)
{
base.InsertItem (index, item);
}
protected override void RemoveItem (int index)
{
base.RemoveItem (index);
}
protected override void SetItem (int index, Attachment item)
{
base.SetItem (index, item);
}
}
}

View File

@@ -0,0 +1,453 @@
2010-06-28 Gonzalo Paniagua Javier <gonzalo@novell.com>
* SmtpClient.cs: support PLAIN authentication and throw if LOGIN and
PLAIN are not supported. Fixes bug #607249.
2010-05-04 Miguel de Icaza <miguel@novell.com>
* Apply patch from Ted Unangst to fix bug 574049
2010-03-06 Gonzalo Paniagua Javier <gonzalo@novell.com>
* SmtpClient.cs: typo in reply-to header. Thanks to Chris Tomlinson.
Fixes bug #578271.
2010-02-15 Gonzalo Paniagua Javier <gonzalo@novell.com>
* SmtpClient.cs: generate correct MIME when there are text and html
linked resources. Fixes bug #579984. Patch by Ásgeir Halldórsson.
2010-01-21 Gonzalo Paniagua Javier <gonzalo@novell.com>
* SmtpClient.cs: rethrow inner exception so that
AsyncCompletedEventArgs.Error gets the right value on error. Patch
by Dimitar Dobrev.
2009-12-11 Miguel de Icaza <miguel@novell.com>
* SmtpClient.cs: Add half-implemented feature, TargetName for the
SPN SMTP system.
* SmtpClient.cs, MailMessage.cs: Add 4.0 APIs.
2009-08-20 Sebastien Pouliot <sebastien@ximian.com>
* SmtpClient.cs: Honor ServicePointManager.
ServerCertificateValidationCallback when provided
2009-08-03 Gonzalo Paniagua Javier <gonzalo@novell.com>
* Attachment.cs: set the body encoding for multipart attachments.
Fixes bug #527177.
2009-06-08 Gonzalo Paniagua Javier <gonzalo@novell.com>
* SmtpClient.cs: handle dots. Patch by Ted Unangst that fixes bug
#392875.
2008-11-17 Gonzalo Paniagua Javier <gonzalo@novell.com>
* SmtpClient.cs: remove unused variable and obsolete comment.
2008-09-17 Miguel de Icaza <miguel@novell.com>
* SmtpClient.cs: Actually set some of the headers like Priority,
ReplyTo and Sender.
2008-09-05 Atsushi Enomoto <atsushi@ximian.com>
* SmtpClient.cs : attachment stream consumption was insufficient.
Fix bug #347553, by David Ion.
2008-08-16 Gert Driesen <drieseng@users.sourceforge.net>
* SmtpClient.cs: Fixed paramname of Argument(Null)Exceptions to match
MS. Removed upper limit check for Port. Modified Send to no longer
allow a whitespace-only Host. Moved checks for SpecifiedPickupDirectory
delivery method to SendFile, and use Path.IsPathRooted to check for
absolute paths instead of using a unix-only check. In Send, wrap all
non-SMTP errors in an SmtpException.
* SmtpException.cs: Correctly chain up all .ctors. Removed extra
null check in deserialization .ctor.
2008-08-15 Atsushi Enomoto <atsushi@ximian.com>
* SmtpClient.cs : fixed bug #382670, based on the patch by Ted
Unangst. DeriveryMethod.SpecifiedPickupDirectory was not supported.
2008-08-14 Atsushi Enomoto <atsushi@ximian.com>
* SmtpClient.cs : Patch by Ted Unangst, fixed bug #392843.
Encode emails correctly as well as join multiple emails
correctly.
2008-08-12 Atsushi Enomoto <atsushi@ximian.com>
* SmtpClient.cs : fixed bug #392682, in the same spirit in the
patch by Ted Unangst, to assure safety on socket closing.
2008-08-07 Atsushi Enomoto <atsushi@ximian.com>
* SmtpClient.cs : Fixed bug #392809, patch by Ted Unangst. Text body
was not copied to byte array which is being sent.
2008-04-21 Andreas Nahr <ClassDevelopment@A-SoftTech.com>
* SmtpClient.cs: Fix bug with string handling
2008-04-21 Andreas Nahr <ClassDevelopment@A-SoftTech.com>
* SmtpClient.cs: Fix formatting
2008-04-20 Gonzalo Paniagua Javier <gonzalo.mono@gmail.com>
* SmtpClient.cs: made ParseExtension() work. After STARTTLS, reset
data retrieved from EHLO.
Fixes bug #377463.
2008-04-03 Juraj Skripsky <js@hotfeet.ch>
* Attachment.cs (InitName): Use Path.GetFileName instead of Substring hack.
Fixes bug #366947.
2008-01-29 Juraj Skripsky <js@hotfeet.ch>
* SmtpClient.cs (ToQuotedPrintable): Escape the escape character "=".
2008-01-29 Juraj Skripsky <js@hotfeet.ch>
* SmtpClient.cs: Remove ':' from the time zone offset in the
mail's date field. Fixes bug #351443.
(ToQuotedPrintable): Make sure text encoded as quoted-printable does
not contain more then 76 chars per line (required by rfc1521). Fixes
bug #351448.
2007-12-06 Atsushi Enomoto <atsushi@ximian.com>
* AlternateView.cs : supply charset info for ContentType.
* SmtpClient.cs : for ToQuotedPrintable() input, don't use utf8
StreamReader to get input string. Just use Encoding.GetBytes().
Fixed bug #346162.
2007-12-05 Atsushi Enomoto <atsushi@ximian.com>
* MailMessage.cs : fixing cosmetic .net compatibility. Automatically
fill ASCII when guessed encoding is nothing.
2007-12-05 Atsushi Enomoto <atsushi@ximian.com>
* SmtpClient.cs : fold base64 string at 76 characters.
Should fix bug #344974.
2007-12-05 Atsushi Enomoto <atsushi@ximian.com>
* Attachment.cs : use correct TransferEncoding when (Text)Encoding
is specified.
* MailMessage.cs : ContentTransferEncoding implementation went into
ContentType.
2007-12-04 Arina Itkes <arinai@mainsoft.com>
* SmtpException.cs, SmtpFailedRecipientException.cs,
SmtpFailedRecipientsException.cs:
Changes for SOAP serialization compatibility with .NET.
2007-11-05 Atsushi Enomoto <atsushi@ximian.com>
fixed bug #339037.
* AlternateView.cs : CreateAlternateViewFromString() allows null
Encoding.
* SmtpClient.cs : looks like when Body is null and AlternativeViews
contains only 1 item, then the alternate view becomes as if it
were just a body. To make this possible, added couple of more
transfer-encoding conversion methods.
For more AlternateViews cases, Body is treated
as empty. With attachments it is even complicated: those alternate
views are just in one boundary, so do not send empty string.
Removed debug output (Console.WriteLine).
What a mess.
2007-10-30 Arina Itkes <arinai@mainsoft.com>
* SmtpClient.cs: Fix of SmtpClient.Read() method:
Added check of string position before calling
Substring and IndexOf methods of string.
2007-10-23 Atsushi Enomoto <atsushi@ximian.com>
* SmtpClient.cs : small async refactory.
2007-10-23 Atsushi Enomoto <atsushi@ximian.com>
* SmtpClient.cs : Implemented async operations.
2007-10-23 Atsushi Enomoto <atsushi@ximian.com>
* Attachment.cs : reverted previous change. NameEncoding is not
guessed at set_Name().
2007-10-22 Atsushi Enomoto <atsushi@ximian.com>
* SmtpClient.cs : lunatic cyclic build.
2007-10-22 Atsushi Enomoto <atsushi@ximian.com>
* AttachmentBase.cs : implemented Dispose(bool).
2007-10-22 Atsushi Enomoto <atsushi@ximian.com>
* AttachmentCollection.cs : remove TODO.
* Attachment.cs : guess NameEncoding when set_Name().
* MailMessage.cs : moved encoding guess impl to ContentType.
* SmtpClient.cs : moved RFC 2047 encoding impl to ContentType.
Support attachment Name encoding. Added some SSL changes (it's not
working yet).
2007-10-22 Atsushi Enomoto <atsushi@ximian.com>
* SmtpClient.cs : attachment refactory. First, determine whether we
send multipart/mixed for attachments. Second, determine whether we
send multipart/alternative for AlternateViews.
Consider LinkedResources. Mark EnableSsl as TODO.
2007-10-22 Atsushi Enomoto <atsushi@ximian.com>
* LinkedResource.cs : Now they are implemented and soon to be
supported. Fixed TransferEncoding (same as other AttachmentBase).
2007-10-22 Atsushi Enomoto <atsushi@ximian.com>
* Attachment.cs : null name is allowed.
2007-10-19 Atsushi Enomoto <atsushi@ximian.com>
* AlternateView.cs, AttachmentView.cs, AttachmentBase.cs :
reverted default back to TransferEncoding.Base64 again, and use
QuotedPrintable only when created from string.
No need to check null Stream at AlternateView.ctor(). See base.
* SmtpClient.cs : For multipart message, do not send body twice (it
still emits extraneous part, which should be fixed too).
Do not premise charset existence in every AttachmentBase.
2007-10-17 Atsushi Enomoto <atsushi@ximian.com>
* AlternateView.cs : dispose linked resources. Remove MonoTODOs.
* Attachment.cs : check null content string.
The string argument in .ctor(Stream,string) is name, not mediaType.
Use contentEncoding argument in CreateAttachmentFromString().
* AttachmentBase.cs : TransferEncoding default is QuotedPrintable.
2007-10-17 Atsushi Enomoto <atsushi@ximian.com>
* MailMessage.cs : removed MonoTODO. some comment.
* SmtpException.cs, SmtpFailedRecipientsException.cs,
SmtpFailedRecipientException.cs : implemented serialization.
2007-10-16 Atsushi Enomoto <atsushi@ximian.com>
* SmtpClient.cs : use 3 StringBuilder.Replace() calls rather than
3 string.Replace() calls.
2007-10-16 Atsushi Enomoto <atsushi@ximian.com>
* SmtpClient.cs : do state check on other setters than set_Timeout().
2007-10-16 Atsushi Enomoto <atsushi@ximian.com>
* MailMessage.cs : Some entire refactory on BodyEncoding and
IsBodyHtml. BodyEncoding and SubjectEncoding are guessed when
Body and Subject are set for each.
* SmtpClient.cs :
Subject header is encoded according to RFC 2047.
Body is encoded according to RFC 2821.
Output Date header.
ToQuotedPrintable() should take encoding into consideration.
For SevenBit/Unknown TransferEncoding, just decode with ASCII.
In set_UseDefaultCredentials(), raise NIE only when value is true.
In set_Timeout(), raise an error when Send() is in progress.
2007-10-16 Atsushi Enomoto <atsushi@ximian.com>
* SmtpClient.cs : Replace every \r and \n with \r\n per RFC 2821
section 2.3.7, or you will receive SMTP error 451.
2007-10-16 Atsushi Enomoto <atsushi@ximian.com>
* AlternateViewCollection.cs, LinkedResourceCollection.cs,
AttachmentCollection.cs : added missing 2.0 members.
2007-06-17 Gert Driesen <drieseng@users.sourceforge.net>
* MailAddress.cs: Throw ArgumentNullException if address is null.
Allow display name to be specified as part of the address. Fixes
bug #81854. Return zero-length string in DisplayName if no display
name is set.
2007-05-31 Jeffrey Stedfast <fejj@gnome.org>
* SmtpClient.cs: Added an extensions parser to figure out if the
ESMTP server supports things like STARTTLS and which AUTH
mechanisms are supported. Don't try authenticating if no authmechs
are supported.
2007-05-30 Jeffrey Stedfast <fejj@novell.com>
* SmtpClient.cs: Fall back to HELO if EHLO fails. Also, do not
write out a Bcc header to the SMTP server - these are meant to be
dropped. MAIL FROM: and RCPT TO: commands are not meant to have a
space after the colon before the address - this will break on some
SMTP servers.
2007-02-16 Geoff Norton <gnorton@customerdna.com>
* SmtpClient.cs: Dont send bare LF. Send <CR><LF> regardless
of platform. (ref: http://cr.yp.to/docs/smtplf.html)
2007-01-20 Miguel de Icaza <miguel@novell.com>
* MailMessage.cs: Add suport to the MailMessage constructor to
take a comma-separated list of addresses (Bug #80548).
2006-12-12 Miguel de Icaza <miguel@novell.com>
* MailMessage.cs: Fix this code so that it correctly reports
ArgumentNullExceptions.
2006-12-12 Atsushi Enomoto <atsushi@ximian.com>
* SmtpClient.cs : use CONFIGURATION_DEP when it is
System.Configuration.dll dependent.
2006-12-10 David Elkind <davide@mainsoft.com>
* Attachment.cs - proper file name handling added
* AttachmentBase.cs - proper MIME type handling added
* MailAddress.cs - Proper mail address handling ('<' and '>' addition) added
* MailMessage.cs - Better construction sequence
* SmtpClient.cs - Added proper handling of composite message (consisting of alternate views/attachments)
- Added handling of user credentials
- Added handling of TLS (under TARGET_JVM)
- Some other minor fixes
2006-12-04 Konstantin Triger <kostat@mainsoft.com>
* SmtpException.cs, SmtpFailedRecipientException.cs: TARGET_JVM limitation workaround.
2006-12-01 Sebastien Pouliot <sebastien@ximian.com>
* SmtpClient.cs: Added MonoTODO for missing SSL/TLS support and
updated existing MonoTODO (or changed them to FIXME) to be clearer
for anyone using the API.
2006-10-31 Sebastien Pouliot <sebastien@ximian.com>
* SmtpException.cs: Fix visibility on .ctor(SerializationInfo,
StreamingContext).
* SmtpPermissionAttribute.cs: New (2.0). Security attribute for SMTP.
* SmtpPermission.cs: New (2.0). Security permission for SMTP.
2006-09-28 Andrew Skiba <andrews@mainsoft.com>
* SmtpClient.cs: TARGET_JVM
2006-03-11 Miguel de Icaza <miguel@novell.com>
* MailAddress.cs: Comment out unused field to remove warning.
2006-1-13 John Luke <john.luke@gmail.com>
* MailMessage.cs: add [MonoTODO] for FormatException in ctor,
throw ArugmentNullException's from the ctors,
add internal BodyContentType property,
change BodyEncoding to use BodyContentType,
change IsBodyHtml to use BodyContentType,
* SmtpClient.cs: set timeout initially to 100000,
don't throw ArgumentOutOfRangeException when Timeout = 0,
add [MonoTODO] for set_host, and throw Exceptions for it,
add [MonoTODO] for UseDefaultCredentials,
get messageContentType from the message,
use "127.0.0.1" for Host and 25 for Port
if host or port is not specified until reading
them from the configuration files is done
2006-1-02 John Luke <john.luke@gmail.com>
* DeliveryNotificationOptions: fix value of Delay
2005-12-26 John Luke <john.luke@gmail.com>
* AttachmentCollection.cs: mark sealed
* DeliveryNotificationOptions.cs: fix values
2005-12-25 John Luke <john.luke@gmail.com>
* SmtpStatusCode.cs: OK > Ok
* AttachmentBase.cs: ContentID > ContentId,
add set_ContentType
* AlternateViewCollection.cs: remove destructor,
make default ctor internal
* MailMessage.cs: add default ctor,
remove destructor
* Attachment.cs: add (string, string) ctor,
add set_NameEncoding
* LinkedResourceCollection.cs: remove destructor,
make default ctor internal
* AttachmentCollection.cs: mark Dispose virtual,
add ISerializable, make default ctor internal
2005-12-24 John Luke <john.luke@gmail.com>
* LinkedResource.cs: new File
* AttachmentBase.cs: new File
* MailPriority.cs: new File
* AlternateViewCollection.cs: new File
* DeliveryNotificationOptions.cs: new File
* SmtpFailedRecipientException.cs: new File
* AlternateView.cs: new File
* LinkedResourceCollection.cs: new File
* MailMessage.cs: add some missing properties, update API for 2.0 final
* Attachment.cs: inherit from AttachmentBase, update API for 2.0 final
* MailAddress.cs: fix ToString, override Equals and GetHashCode
* SmtpFailedRecipientsException.cs: use SmtpFailedRecipientException
* SmtpException.cs: add [Serializable], ISerializable
* MailAddressCollection.cs: inherit from Collection<MailAddress>
* AttachmentCollection.cs: inherit from Collection<Attachment>
* SmtpAccess.cs: add missing value
* SmtpClient.cs: update for 2.0 final API
* SmtpStatusCode.cs: add missing value
2005-12-24 John Luke <john.luke@gmail.com>
* MailMessage.cs: use text/plain by default,
patch by Andy Waddell <awaddell@fnfr.com>,
fixes bug #76972
2005-12-22 John Luke <john.luke@gmail.com>
* SmtpClient.cs: remove use of TransferEncodings that
no longer exist in .net 2 final API
2005-12-14 Chris Toshok <toshok@ximian.com>
* SmtpDeliveryMethod.cs: new enum.
2004-09-10 Tim Coleman <tim@timcoleman.com>
* SmtpClient.cs SmtpFailedRecipientsException.cs:
Add failed recipient exception handling.
2004-09-09 Tim Coleman <tim@timcoleman.com>
* AttachmentCollection.cs MailAddressCollection.cs:
New classes
* Attachment.cs: Set content string
* MailMessage.cs: Use new collection classes
* SmtpClient.cs: Lots of MIME cleanup
2004-09-08 Tim Coleman <tim@timcoleman.com>
* Attachment.cs: Add SetContentFromFile methods
* MailMessage.cs: Add MIME-Version header
* SmtpClient.cs: Add some attachment handling.
2004-09-04 Tim Coleman <tim@timcoleman.com>
* Attachment.cs MailAddress.cs MailMessage.cs SendCompletedEventHandler.cs
* SmtpAccess.cs SmtpClient.cs SmtpException.cs SmtpStatusCode.cs:
New class stubs for 2.0

View File

@@ -0,0 +1,45 @@
//
// System.Net.Mail.DeliveryNotificationOptions
//
// Authors:
// John Luke (john.luke@gmail.com)
//
// (C) 2005 John Luke
//
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
namespace System.Net.Mail {
[Flags]
public enum DeliveryNotificationOptions
{
None,
OnSuccess,
OnFailure,
Delay = 4,
Never = 134217728,
}
}

View File

@@ -0,0 +1,129 @@
//
// System.Net.Mail.LinkedResource.cs
//
// Author:
// John Luke (john.luke@gmail.com)
//
// Copyright (C) John Luke, 2005
//
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System.IO;
using System.Net.Mime;
using System.Text;
namespace System.Net.Mail {
public class LinkedResource : AttachmentBase
{
#region Fields
Uri contentLink;
#endregion // Fields
#region Constructors
public LinkedResource (string fileName) : base (fileName)
{
if (fileName == null)
throw new ArgumentNullException ();
}
public LinkedResource (string fileName, ContentType contentType) : base (fileName, contentType)
{
if (fileName == null)
throw new ArgumentNullException ();
}
public LinkedResource (string fileName, string mediaType) : base (fileName, mediaType)
{
if (fileName == null)
throw new ArgumentNullException ();
}
public LinkedResource (Stream contentStream) : base (contentStream)
{
if (contentStream == null)
throw new ArgumentNullException ();
}
public LinkedResource (Stream contentStream, ContentType contentType) : base (contentStream, contentType)
{
if (contentStream == null)
throw new ArgumentNullException ();
}
public LinkedResource (Stream contentStream, string mediaType) : base (contentStream, mediaType)
{
if (contentStream == null)
throw new ArgumentNullException ();
}
#endregion // Constructors
#region Properties
public Uri ContentLink {
get { return contentLink; }
set { contentLink = value; }
}
#endregion // Properties
#region Methods
public static LinkedResource CreateLinkedResourceFromString (string content)
{
if (content == null)
throw new ArgumentNullException ();
MemoryStream ms = new MemoryStream (Encoding.Default.GetBytes (content));
LinkedResource lr = new LinkedResource (ms);
lr.TransferEncoding = TransferEncoding.QuotedPrintable;
return lr;
}
public static LinkedResource CreateLinkedResourceFromString (string content, ContentType contentType)
{
if (content == null)
throw new ArgumentNullException ();
MemoryStream ms = new MemoryStream (Encoding.Default.GetBytes (content));
LinkedResource lr = new LinkedResource (ms, contentType);
lr.TransferEncoding = TransferEncoding.QuotedPrintable;
return lr;
}
public static LinkedResource CreateLinkedResourceFromString (string content, Encoding contentEncoding, string mediaType)
{
if (content == null)
throw new ArgumentNullException ();
MemoryStream ms = new MemoryStream (contentEncoding.GetBytes (content));
LinkedResource lr = new LinkedResource (ms, mediaType);
lr.TransferEncoding = TransferEncoding.QuotedPrintable;
return lr;
}
#endregion // Methods
}
}

View File

@@ -0,0 +1,88 @@
//
// System.Net.Mail.LinkedResourceCollection.cs
//
// Author:
// John Luke (john.luke@gmail.com)
//
// Copyright (C) John Luke, 2005
//
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System.Collections.ObjectModel;
using System.Net.Mime;
namespace System.Net.Mail {
public sealed class LinkedResourceCollection : Collection<LinkedResource>, IDisposable
{
#region Fields
#endregion // Fields
#region Constructors
internal LinkedResourceCollection ()
{
}
#endregion // Constructors
#region Properties
#endregion // Properties
#region Methods
public void Dispose ()
{
Dispose (true);
GC.SuppressFinalize (this);
}
private void Dispose (bool disposing)
{
}
protected override void ClearItems ()
{
base.ClearItems ();
}
protected override void InsertItem (int index, LinkedResource item)
{
base.InsertItem (index, item);
}
protected override void RemoveItem (int index)
{
base.RemoveItem (index);
}
protected override void SetItem (int index, LinkedResource item)
{
base.SetItem (index, item);
}
#endregion // Methods
}
}

View File

@@ -0,0 +1,180 @@
//
// System.Net.Mail.MailAddress.cs
//
// Author:
// Tim Coleman (tim@timcoleman.com)
//
// Copyright (C) Tim Coleman, 2004
//
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System.Text;
namespace System.Net.Mail {
public class MailAddress
{
#region Fields
string address;
string displayName;
string host;
string user;
string to_string;
//Encoding displayNameEncoding;
#endregion // Fields
#region Constructors
public MailAddress (string address) : this (address, null)
{
}
public MailAddress (string address, string displayName) : this (address, displayName, Encoding.UTF8)
{
}
[MonoTODO ("We don't do anything with displayNameEncoding")]
public MailAddress (string address, string displayName, Encoding displayNameEncoding)
{
if (address == null)
throw new ArgumentNullException ("address");
if (address.Length == 0)
throw new ArgumentException ("address");
if (displayName != null)
this.displayName = displayName.Trim ();
ParseAddress (address);
}
void ParseAddress (string address)
{
// 1. Quotes for display name
address = address.Trim ();
int idx = address.IndexOf ('"');
if (idx != -1) {
if (idx != 0 || address.Length == 1)
throw CreateFormatException ();
int closing = address.LastIndexOf ('"');
if (closing == idx)
throw CreateFormatException ();
if (this.displayName == null)
this.displayName = address.Substring (idx + 1, closing - idx - 1).Trim ();
address = address.Substring (closing + 1).Trim ();
}
// 2. <email>
idx = address.IndexOf ('<');
if (idx >= 0) {
if (this.displayName == null)
this.displayName = address.Substring (0, idx).Trim ();
if (address.Length - 1 == idx)
throw CreateFormatException ();
int end = address.IndexOf ('>', idx + 1);
if (end == -1)
throw CreateFormatException ();
address = address.Substring (idx + 1, end - idx - 1).Trim ();
}
this.address = address;
// 3. email
idx = address.IndexOf ('@');
if (idx <= 0)
throw CreateFormatException ();
if (idx != address.LastIndexOf ('@'))
throw CreateFormatException ();
this.user = address.Substring (0, idx).Trim ();
if (user.Length == 0)
throw CreateFormatException ();
this.host = address.Substring (idx + 1).Trim ();
if (host.Length == 0)
throw CreateFormatException ();
}
#endregion // Constructors
#region Properties
public string Address {
get { return address; }
}
public string DisplayName {
get {
if (displayName == null)
return string.Empty;
return displayName;
}
}
public string Host {
get { return host; }
}
public string User {
get { return user; }
}
#endregion // Properties
#region Methods
public override bool Equals (object obj)
{
if (obj == null)
return false;
return (0 == String.Compare (ToString (), obj.ToString (), StringComparison.OrdinalIgnoreCase));
}
public override int GetHashCode ()
{
return ToString ().GetHashCode ();
}
public override string ToString ()
{
if (to_string != null)
return to_string;
if (!String.IsNullOrEmpty (displayName))
to_string = String.Format ("\"{0}\" <{1}>", DisplayName, Address);
else
to_string = address;
return to_string;
}
private static FormatException CreateFormatException () {
return new FormatException ("The specified string is not in the "
+ "form required for an e-mail address.");
}
#endregion // Methods
}
}

View File

@@ -0,0 +1,74 @@
//
// System.Net.Mail.MailAddressCollection.cs
//
// Author:
// Tim Coleman (tim@timcoleman.com)
//
// Copyright (C) Tim Coleman, 2004
//
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
using System.Collections.ObjectModel;
using System.Text;
namespace System.Net.Mail {
public class MailAddressCollection : Collection<MailAddress>
{
#region Methods
public void Add (string addresses)
{
foreach (string address in addresses.Split (','))
Add (new MailAddress (address));
}
protected override void InsertItem (int index, MailAddress item)
{
if (item == null)
throw new ArgumentNullException ();
base.InsertItem (index, item);
}
protected override void SetItem (int index, MailAddress item)
{
if (item == null)
throw new ArgumentNullException ();
base.SetItem (index, item);
}
public override string ToString ()
{
StringBuilder sb = new StringBuilder ();
for (int i = 0; i < Count; i += 1) {
if (i > 0)
sb.Append (", ");
sb.Append (this [i].ToString ());
}
return sb.ToString ();
}
#endregion
}
}

View File

@@ -0,0 +1,263 @@
//
// System.Net.Mail.MailMessage.cs
//
// Author:
// Tim Coleman (tim@timcoleman.com)
//
// Copyright (C) Tim Coleman, 2004
//
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System.Collections.Specialized;
using System.Globalization;
using System.Net.Mime;
using System.Text;
namespace System.Net.Mail {
public class MailMessage : IDisposable
{
#region Fields
AlternateViewCollection alternateViews;
AttachmentCollection attachments;
MailAddressCollection bcc;
MailAddressCollection replyTo;
string body;
MailPriority priority;
MailAddress sender;
DeliveryNotificationOptions deliveryNotificationOptions;
MailAddressCollection cc;
MailAddress from;
NameValueCollection headers;
MailAddressCollection to;
string subject;
Encoding subjectEncoding, bodyEncoding, headersEncoding = Encoding.UTF8;
bool isHtml;
#endregion // Fields
#region Constructors
public MailMessage () {
this.to = new MailAddressCollection ();
alternateViews = new AlternateViewCollection ();
attachments = new AttachmentCollection ();
bcc = new MailAddressCollection ();
cc = new MailAddressCollection ();
replyTo = new MailAddressCollection ();
headers = new NameValueCollection ();
headers.Add ("MIME-Version", "1.0");
}
// FIXME: should it throw a FormatException if the addresses are wrong?
// (How is it possible to instantiate such a malformed MailAddress?)
public MailMessage (MailAddress from, MailAddress to) : this ()
{
if (from == null || to == null)
throw new ArgumentNullException ();
From = from;
this.to.Add (to);
}
public MailMessage (string from, string to) : this ()
{
if (from == null || from == String.Empty)
throw new ArgumentNullException ("from");
if (to == null || to == String.Empty)
throw new ArgumentNullException ("to");
this.from = new MailAddress (from);
foreach (string recipient in to.Split (new char [] {','}))
this.to.Add (new MailAddress (recipient.Trim ()));
}
public MailMessage (string from, string to, string subject, string body) : this ()
{
if (from == null || from == String.Empty)
throw new ArgumentNullException ("from");
if (to == null || to == String.Empty)
throw new ArgumentNullException ("to");
this.from = new MailAddress (from);
foreach (string recipient in to.Split (new char [] {','}))
this.to.Add (new MailAddress (recipient.Trim ()));
Body = body;
Subject = subject;
}
#endregion // Constructors
#region Properties
public AlternateViewCollection AlternateViews {
get { return alternateViews; }
}
public AttachmentCollection Attachments {
get { return attachments; }
}
public MailAddressCollection Bcc {
get { return bcc; }
}
public string Body {
get { return body; }
set {
// autodetect suitable body encoding (ASCII or UTF-8), if it is not initialized yet.
if (value != null && bodyEncoding == null)
bodyEncoding = GuessEncoding (value) ?? Encoding.ASCII;
body = value;
}
}
internal ContentType BodyContentType {
get {
ContentType ct = new ContentType (isHtml ? "text/html" : "text/plain");
ct.CharSet = (BodyEncoding ?? Encoding.ASCII).HeaderName;
return ct;
}
}
internal TransferEncoding ContentTransferEncoding {
get { return ContentType.GuessTransferEncoding (BodyEncoding); }
}
public Encoding BodyEncoding {
get { return bodyEncoding; }
set { bodyEncoding = value; }
}
public MailAddressCollection CC {
get { return cc; }
}
public DeliveryNotificationOptions DeliveryNotificationOptions {
get { return deliveryNotificationOptions; }
set { deliveryNotificationOptions = value; }
}
public MailAddress From {
get { return from; }
set { from = value; }
}
public NameValueCollection Headers {
get { return headers; }
}
public bool IsBodyHtml {
get { return isHtml; }
set { isHtml = value; }
}
public MailPriority Priority {
get { return priority; }
set { priority = value; }
}
#if NET_4_0
public
#else
internal
#endif
Encoding HeadersEncoding {
get { return headersEncoding; }
set { headersEncoding = value; }
}
#if NET_4_0
public
#else
internal
#endif
MailAddressCollection ReplyToList {
get { return replyTo; }
}
#if NET_4_0
[Obsolete ("Use ReplyToList instead")]
#endif
public MailAddress ReplyTo {
get {
if (replyTo.Count == 0)
return null;
return replyTo [0];
}
set {
replyTo.Clear ();
replyTo.Add (value);
}
}
public MailAddress Sender {
get { return sender; }
set { sender = value; }
}
public string Subject {
get { return subject; }
set {
if (value != null && subjectEncoding == null)
subjectEncoding = GuessEncoding (value);
subject = value;
}
}
public Encoding SubjectEncoding {
get { return subjectEncoding; }
set { subjectEncoding = value; }
}
public MailAddressCollection To {
get { return to; }
}
#endregion // Properties
#region Methods
public void Dispose ()
{
Dispose (true);
GC.SuppressFinalize (this);
}
protected virtual void Dispose (bool disposing)
{
}
private Encoding GuessEncoding (string s)
{
return ContentType.GuessEncoding (s);
}
#endregion // Methods
}
}

View File

@@ -0,0 +1,41 @@
//
// System.Net.Mail.MailPriority
//
// Authors:
// John Luke (john.luke@gmail.com)
//
// (C) 2005 John Luke
//
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
namespace System.Net.Mail {
public enum MailPriority
{
Normal,
Low,
High,
}
}

View File

@@ -0,0 +1,37 @@
//
// System.Net.Mail.SendCompletedEventHandler.cs
//
// Author:
// Tim Coleman (tim@timcoleman.com)
//
// Copyright (C) Tim Coleman, 2004
//
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System.ComponentModel;
namespace System.Net.Mail
{
public delegate void SendCompletedEventHandler (object sender, AsyncCompletedEventArgs e);
}

View File

@@ -0,0 +1,39 @@
//
// System.Net.Mail.SmtpAccess.cs
//
// Author:
// Tim Coleman (tim@timcoleman.com)
//
// Copyright (C) Tim Coleman, 2004
//
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
namespace System.Net.Mail {
public enum SmtpAccess
{
None,
Connect,
ConnectToUnrestrictedPort,
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,41 @@
//
// System.Net.Configuration.SmtpSection
//
// Authors:
// Chris Toshok (toshok@ximian.com)
//
// (C) 2005 Novell, Inc. (http://www.novell.com)
//
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
namespace System.Net.Mail {
public enum SmtpDeliveryMethod
{
Network = 0,
SpecifiedPickupDirectory = 1,
PickupDirectoryFromIis = 2
}
}

View File

@@ -0,0 +1,109 @@
//
// System.Net.Mail.SmtpException.cs
//
// Author:
// Tim Coleman (tim@timcoleman.com)
//
// Copyright (C) Tim Coleman, 2004
//
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System.Runtime.Serialization;
namespace System.Net.Mail {
[Serializable]
public class SmtpException : Exception, ISerializable
{
#region Fields
SmtpStatusCode statusCode;
#endregion // Fields
#region Constructors
public SmtpException ()
: this (SmtpStatusCode.GeneralFailure)
{
}
public SmtpException (SmtpStatusCode statusCode)
: this (statusCode, "Syntax error, command unrecognized.")
{
}
public SmtpException (string message)
: this (SmtpStatusCode.GeneralFailure, message)
{
}
protected SmtpException (SerializationInfo info, StreamingContext context)
: base (info, context)
{
try {
statusCode = (SmtpStatusCode) info.GetValue ("Status", typeof (int));
} catch (SerializationException) {
//For compliance with previously serialized version:
statusCode = (SmtpStatusCode) info.GetValue ("statusCode", typeof (SmtpStatusCode));
}
}
public SmtpException (SmtpStatusCode statusCode, string message)
: base (message)
{
this.statusCode = statusCode;
}
public SmtpException (string message, Exception innerException)
: base (message, innerException)
{
statusCode = SmtpStatusCode.GeneralFailure;
}
#endregion // Constructors
#region Properties
public SmtpStatusCode StatusCode {
get { return statusCode; }
set { statusCode = value; }
}
#endregion // Properties
public override void GetObjectData (SerializationInfo info, StreamingContext context)
{
if (info == null)
throw new ArgumentNullException ("info");
base.GetObjectData (info, context);
info.AddValue ("Status", statusCode, typeof (int));
}
#if !TARGET_JVM //remove private implementation
void ISerializable.GetObjectData (SerializationInfo info, StreamingContext context)
{
GetObjectData (info, context);
}
#endif
}
}

View File

@@ -0,0 +1,111 @@
//
// System.Net.Mail.SmtpFailedRecipientException.cs
//
// Author:
// John Luke (john.luke@gmail.com)
//
// Copyright (C) John Luke, 2005
//
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System;
using System.Collections;
using System.Runtime.Serialization;
namespace System.Net.Mail {
[Serializable]
public class SmtpFailedRecipientException : SmtpException, ISerializable
{
#region Fields
string failedRecipient;
#endregion // Fields
#region Constructors
public SmtpFailedRecipientException ()
{
}
public SmtpFailedRecipientException (string message) : base (message)
{
}
protected SmtpFailedRecipientException (SerializationInfo serializationInfo, StreamingContext streamingContext)
: base (serializationInfo, streamingContext)
{
if (serializationInfo == null)
throw new ArgumentNullException ("serializationInfo");
failedRecipient = serializationInfo.GetString ("failedRecipient");
}
public SmtpFailedRecipientException (SmtpStatusCode statusCode, string failedRecipient) : base (statusCode)
{
this.failedRecipient = failedRecipient;
}
public SmtpFailedRecipientException (string message, Exception innerException) : base (message, innerException)
{
}
public SmtpFailedRecipientException (string message, string failedRecipient, Exception innerException) : base (message, innerException)
{
this.failedRecipient = failedRecipient;
}
public SmtpFailedRecipientException (SmtpStatusCode statusCode, string failedRecipient, string serverResponse) : base (statusCode, serverResponse)
{
this.failedRecipient = failedRecipient;
}
#endregion // Constructors
#region Properties
public string FailedRecipient {
get { return failedRecipient; }
}
#endregion // Properties
#region Methods
public override void GetObjectData (SerializationInfo serializationInfo, StreamingContext streamingContext)
{
if (serializationInfo == null)
throw new ArgumentNullException ("serializationInfo");
base.GetObjectData (serializationInfo, streamingContext);
serializationInfo.AddValue ("failedRecipient", failedRecipient);
}
#if !TARGET_JVM //remove private implementation
void ISerializable.GetObjectData (SerializationInfo serializationInfo, StreamingContext streamingContext)
{
GetObjectData (serializationInfo, streamingContext);
}
#endif
#endregion // Methods
}
}

View File

@@ -0,0 +1,101 @@
//
// System.Net.Mail.SmtpFailedRecipientsException.cs
//
// Author:
// Tim Coleman (tim@timcoleman.com)
//
// Copyright (C) Tim Coleman, 2004
//
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System.Collections;
using System.Runtime.Serialization;
namespace System.Net.Mail {
[Serializable]
public class SmtpFailedRecipientsException : SmtpFailedRecipientException, ISerializable
{
#region Fields
SmtpFailedRecipientException[] innerExceptions;
#endregion // Fields
#region Constructors
public SmtpFailedRecipientsException ()
{
}
public SmtpFailedRecipientsException (string message) : base (message)
{
}
public SmtpFailedRecipientsException (string message, Exception innerException) : base (message, innerException)
{
}
public SmtpFailedRecipientsException (string message, SmtpFailedRecipientException[] innerExceptions) : base (message)
{
this.innerExceptions = innerExceptions;
}
protected SmtpFailedRecipientsException (SerializationInfo info, StreamingContext context)
: base(info, context)
{
if (info == null)
throw new ArgumentNullException ("info");
innerExceptions = (SmtpFailedRecipientException []) info.GetValue ("innerExceptions", typeof (SmtpFailedRecipientException []));
}
#endregion
#region Properties
public SmtpFailedRecipientException[] InnerExceptions {
get { return innerExceptions; }
}
#endregion // Properties
#region Methods
public override void GetObjectData (SerializationInfo info, StreamingContext context)
{
if (info == null)
throw new ArgumentNullException ("info");
base.GetObjectData (info, context);
info.AddValue ("innerExceptions", innerExceptions);
}
#if !TARGET_JVM //remove private implementation
void ISerializable.GetObjectData (SerializationInfo info, StreamingContext context)
{
GetObjectData (info, context);
}
#endif
#endregion // Methods
}
}

Some files were not shown because too many files have changed in this diff Show More