You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

40 lines
1.1 KiB

  1. using System;
  2. using System.Collections.Generic;
  3. using System.Text;
  4. namespace Apewer.Network
  5. {
  6. /// <summary>扩展方法。</summary>
  7. public static class Extension
  8. {
  9. /// <summary>添加邮件账户。</summary>
  10. public static void Add(this List<MailAddress> value, string address, string name)
  11. {
  12. if (value == null) return;
  13. value.Add(new MailAddress(address, name));
  14. }
  15. /// <summary>添加邮件账户。</summary>
  16. public static void Add(this List<MailAddress> value, string address)
  17. {
  18. if (value == null) return;
  19. value.Add(new MailAddress(address));
  20. }
  21. /// <summary>发送邮件。</summary>
  22. public static MailRecord Send(this MailClient value, MailMessage message)
  23. {
  24. return MailMethods.Send(value, message);
  25. }
  26. /// <summary>发送邮件。</summary>
  27. public static MailRecord Send(this MailClient value, string sender, string receiver, string content = null, string title = null)
  28. {
  29. return MailMethods.Send(value, sender, receiver, content, title);
  30. }
  31. }
  32. }