【问题标题】:Is there a fluent email library for c#?是否有适用于 c# 的流畅电子邮件库?
【发布时间】:2011-02-17 12:08:55
【问题描述】:

我最近一直在写一堆电子邮件代码,我突然想到,如果有一个库可以让你流利地用 c# 创建电子邮件,那会很酷。

我快速浏览了一下,但找不到任何东西,所以想知道是否有人知道是否已经存在用于 c# 的流利电子邮件库?

【问题讨论】:

  • 流利是什么意思? System.Net.Mail 对您来说太难使用了吗?当然,您可以创建自己的类来包装它并使其更易于使用...
  • 认为他想要类似:Send(message).To(recipient).And(recipient2).From(sender).Now();

标签: c# email fluent-interface


【解决方案1】:

我最终在 GitHub 上找到了这个,它可以很好地满足我的需求

https://github.com/dkarzon/FluentEmail

还有一个额外的好处是允许可以像这样使用的模板:

var email = Email
            .From("john@email.com")
            .To("bob@email.com", "bob")
            .Subject("hows it going bob")
            .UsingTemplate(@"C:\Emailer\TransactionTemplate.htm")
            .Replace("<%CurrentDate%>", DateTime.Now.ToShortDateString())
            .Replace("<%FullName%>", fullName)
            .Replace("<%SaleDate%>", saleDate)

【讨论】:

    【解决方案2】:

    您可以查看我的Mail.dll email component

    Mail.Html(@"Html with an image: <img src=""cid:lena="""" />")
      .AddVisual(@"c:\lena.jpeg").SetContentId("lena")
      .AddAttachment(@"c:\tmp.doc").SetFileName("document.doc")
      .To("to@mail.com")
      .From("from@mail.com")
      .Subject("Subject")
      .SignWith(new X509Certificate2("SignCertificate.pfx", ""))
      .EncryptWith(new X509Certificate2("EncryptCertificate.pfx", ""))
      .EncryptWith(new X509Certificate2("BobsCertificate.pfx", ""))
      .UsingNewSmtp()
      .Server("smtp.example.com")
      .Send();
    

    但它不是免费的,流畅的界面只是语法糖。

    【讨论】:

      【解决方案3】:

      我的班级:D http://www.mediafire.com/download/m7oua8gf4ject8m/Mail.cs

      使用:

      using Mailling;
      
          MailController m = new MailController("username", "password");
      
          private void Form1_Load(object sender, EventArgs e)
          {
              //Gett Mails
              List<Mail> mails = m.GetAllMails();
              foreach (Mail item in mails)
              {
                  MessageBox.Show("From : "+item.From+"\n"+"Title: "+item.Title+"\n"+"Summary : "+item.Summary);
              }
      
              //SendMail
              m.SendMail("username", "password", "title", "summary");
      
          }
      

      【讨论】:

        【解决方案4】:

        你也可以看看这个。功能齐全且易于使用。提供了一种构建模板电子邮件的绝妙方法。

        http://www.avantprime.com/products/view-product/8/fluent-mail

        【讨论】:

          猜你喜欢
          • 2012-03-18
          • 2015-04-02
          • 2017-10-12
          • 1970-01-01
          • 2010-09-14
          • 1970-01-01
          • 1970-01-01
          • 2011-12-21
          • 1970-01-01
          相关资源
          最近更新 更多