Example #1
0
        public static void Send(MailMessage message)
        {
            lock (_lockObject) {
#if !FEATURE_PAL // FEATURE_PAL does not enable SmtpMail
                if (Environment.OSVersion.Platform != PlatformID.Win32NT)
                {
                    throw new PlatformNotSupportedException(SR.GetString(SR.RequiresNT));
                }
                else if (!CdoSysHelper.OsSupportsCdoSys())
                {
                    throw new PlatformNotSupportedException(SR.GetString(SR.SmtpMail_not_supported_on_Win7_and_higher));
                }
                else if (Environment.OSVersion.Version.Major <= 4)
                {
                    CdoNtsHelper.Send(message);
                }
                else
                {
                    CdoSysHelper.Send(message);
                }
#else // !FEATURE_PAL
                throw new NotImplementedException("ROTORTODO");
#endif // !FEATURE_PAL
            }
        }
Example #2
0
        /// <include file='doc\SmtpMail.uex' path='docs/doc[@for="SmtpMail.Send1"]/*' />
        /// <devdoc>
        ///    <para>[To be supplied.]</para>
        /// </devdoc>
        public static void Send(MailMessage message)
        {
            InternalSecurityPermissions.AspNetHostingPermissionLevelMedium.Demand();
            InternalSecurityPermissions.UnmanagedCode.Assert();

            lock (typeof(SmtpMail)) {
                if (Environment.OSVersion.Platform != PlatformID.Win32NT)
                {
                    throw new PlatformNotSupportedException(SR.GetString(SR.RequiresNT));
                }
                else if (Environment.OSVersion.Version.Major <= 4)
                {
                    CdoNtsHelper.Send(message);
                }
                else
                {
                    CdoSysHelper.Send(message);
                }
            }
        }
 public static void Send(string from, string to, string subject, string messageText)
 {
     lock (_lockObject)
     {
         if (Environment.OSVersion.Platform != PlatformID.Win32NT)
         {
             throw new PlatformNotSupportedException(System.Web.SR.GetString("RequiresNT"));
         }
         if (!CdoSysHelper.OsSupportsCdoSys())
         {
             throw new PlatformNotSupportedException(System.Web.SR.GetString("SmtpMail_not_supported_on_Win7_and_higher"));
         }
         if (Environment.OSVersion.Version.Major <= 4)
         {
             CdoNtsHelper.Send(from, to, subject, messageText);
         }
         else
         {
             CdoSysHelper.Send(from, to, subject, messageText);
         }
     }
 }