English 中文(简体)
C# 发送电子邮件,使用含蓄的斜体[封闭]
原标题:C# send email using implicit ssl [closed]

我们不准许对书籍、工具、软件图书馆以及更多的图书馆征求建议的问题。 你可以ed问这个问题,以便用事实和引言回答。

Closed 4 months ago.

是否有任何图书馆可以免费使用,以便使用含蓄的 ssl规程进行电子邮件。 我的主办者支持电子邮件......但标准电子邮件客户不能这样做。

问题回答

系统。 净额 邮件确实支持“合法的SSL”(也称为“StartTLS”――通常在25或587港,但并非“简单的SSL”(“SMTPS”――通常在465港)。

As far as I know, explicit SSL starts from an unsecured connection, then the STARTTLS command is given and finally a SSL secured connection is made. Implicit SSL, on the other side, requires that the SSL connection is set up before the two parties start talking.

Some servers (like gmail) accept both, so you simply need to set EnableSsl to true and send to the right port. If your server does not support explict SSL, though, this "simple way" is not an option.

I m also still looking around for a general solution for using System.Net.Mail with implicit SSL, with no luck so far.

查询,可向您提供一些见解。

[edit: @Nikita is right, established port number to prevent/60/6]

http://msdn.microsoft.com/en-us/library/system.web.mailmessage.aspx”rel=“nofollow”System.Web.mail.Message,(并设置了http://schemas.microsoft.com/cdo/configuration/smtpussless”

System.Web.Mail.MailMessage mailMsg = new System.Web.Mail.MailMessage();
// ...
mailMsg.Fields.Add
            ("http://schemas.microsoft.com/cdo/configuration/smtpusessl",
                 true);

或者,如果你能够,你可以操作像stunnel。 在当地,从您的<代码> 当地东道/代码>向您的员工和管理当局协调署服务器建立SSL/TLS隧道。 然后,你通常(没有SSL/TLS)与隧道条码(<> 当地<>/代码>连接,作为你的员工和管理当局协调署服务器。

作为备选办法之一,我们的安全网包括:SMTP部分,该部分通过暗含和明确的SSL开展工作,并支持不同的认证机制(包括SASL、NTLM等)。

您可以使用AIM(Aegis 非法邮件)通过暗含的SSL发送电子邮件:

  1. First install the package: Install-Package AIM
  2. 之后 利用样本代码发送电子邮件

    class Mail
    {
        private static string mailAddress = "{you email address}";
        private static string host = "{your host server}";
        private static string userName = "{your user name}";
        private static string password = "{your password}";
        private static string userTo = "{to address}";
        private static void SendEmail(string subject, string message)
        {
            //Generate Message 
            var mailMessage = new MimeMailMessage();
            mailMessage.From = new MimeMailAddress(mailAddress);
            mailMessage.To.Add(userTo);
            mailMessage.Subject = subject;
            mailMessage.Body = message;
    
            //Create Smtp Client
            var mailer = new MimeMailer(host, 465);
            mailer.User = userName;
            mailer.Password = password;
            mailer.SslType = SslMode.Ssl;
            mailer.AuthenticationMode = AuthenticationType.Base64;
    
            //Set a delegate function for call back
            mailer.SendCompleted += compEvent;
            mailer.SendMailAsync(mailMessage);
        }
    
        //Call back function
        private static void compEvent(object sender, AsyncCompletedEventArgs e)
        {
            if (e.UserState != null)
                Console.Out.WriteLine(e.UserState.ToString());
    
            Console.Out.WriteLine("is it canceled? " + e.Cancelled);
    
            if (e.Error != null)
                Console.Out.WriteLine("Error : " + e.Error.Message);
        }
    }
    




相关问题
Anyone feel like passing it forward?

I m the only developer in my company, and am getting along well as an autodidact, but I know I m missing out on the education one gets from working with and having code reviewed by more senior devs. ...

NSArray s, Primitive types and Boxing Oh My!

I m pretty new to the Objective-C world and I have a long history with .net/C# so naturally I m inclined to use my C# wits. Now here s the question: I feel really inclined to create some type of ...

C# Marshal / Pinvoke CBitmap?

I cannot figure out how to marshal a C++ CBitmap to a C# Bitmap or Image class. My import looks like this: [DllImport(@"test.dll", CharSet = CharSet.Unicode)] public static extern IntPtr ...

How to Use Ghostscript DLL to convert PDF to PDF/A

How to user GhostScript DLL to convert PDF to PDF/A. I know I kind of have to call the exported function of gsdll32.dll whose name is gsapi_init_with_args, but how do i pass the right arguments? BTW, ...

Linqy no matchy

Maybe it s something I m doing wrong. I m just learning Linq because I m bored. And so far so good. I made a little program and it basically just outputs all matches (foreach) into a label control. ...