// Lawrence Pit (loz@cable.a2000.nl)
// Per Arneng (pt99par@student.bth.se) (SmtpMail.Send)
//
-
+// Copyright (C) 2004-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
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
-using System;
using System.Net;
using System.Net.Sockets;
using System.Text;
using System.IO;
using System.Reflection;
+using System.Security.Permissions;
namespace System.Web.Mail
{
- /// <remarks>
- /// </remarks>
- public class SmtpMail
+ // CAS
+ [Obsolete ("The recommended alternative is System.Net.Mail.SmtpClient. http://go.microsoft.com/fwlink/?linkid=14202")]
+ public class SmtpMail
{
- private static string smtpServer = "localhost";
+ static string smtpServer = "localhost";
- // Constructor
- private SmtpMail ()
+ // Constructor
+ SmtpMail ()
{
/* empty */
- }
+ }
// Properties
public static string SmtpServer {
set { smtpServer = value; }
}
-
+ // Medium (not Minimal) here
+ // http://msdn.microsoft.com/library/en-us/dnpag2/html/paght000017.asp
+ [AspNetHostingPermission (SecurityAction.Demand, Level = AspNetHostingPermissionLevel.Medium)]
public static void Send (MailMessage message)
{
// access to properties and to add some functionality
MailMessageWrapper messageWrapper = new MailMessageWrapper( message );
-#if TARGET_JVM
- string currentSmtpServer = smtpServer;
- if (currentSmtpServer == "localhost")
- {
- java.net.InetAddress address = java.net.InetAddress.getLocalHost();
- currentSmtpServer = address.getHostAddress();
- }
- SmtpClient smtp = new SmtpClient (currentSmtpServer);
-#else
SmtpClient smtp = new SmtpClient (smtpServer);
-#endif
smtp.Send (messageWrapper);
message.Body = messageText;
Send (message);
}
-
}
-
-} //namespace System.Web.Mail
+}