EmailServerInfo.cs 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Linq;
  5. using System.Text;
  6. namespace PMS.Plugins.Email
  7. {
  8. /// <summary>
  9. /// 服务器信息
  10. /// </summary>
  11. [Serializable]
  12. public class EmailServerInfo : ICloneable
  13. {
  14. /// <summary>
  15. /// 邮件发送服务器相关配置
  16. /// </summary>
  17. /// <param name="host">主机协议</param>
  18. /// <param name="sendName">发送者名称</param>
  19. /// <param name="email">发送者邮件</param>
  20. /// <param name="password">发送者密码</param>
  21. /// <param name="port">发送端口</param>
  22. public EmailServerInfo(string host, string sendName, string email, string password, int port = 25)
  23. {
  24. this.Host = host;
  25. this.Port = port;
  26. this.SendUserName = sendName;
  27. this.SendEmail = email;
  28. this.SendEmailPassword = password;
  29. }
  30. /// <summary>
  31. /// 邮件服务器主机:例如,smtp.zlsoft.cn
  32. /// </summary>
  33. [Category("1.邮件服务器")]
  34. [Description("邮件服务器主机地址,用于发送邮件,例如: mail.zlsoft.cn")]
  35. public string Host { get; set; }
  36. /// <summary>
  37. /// 邮件发送端口,默认为25
  38. /// </summary>
  39. [Category("1.邮件服务器")]
  40. [Description("邮件服务器主机端口,默认stmp使用25")]
  41. public int Port { get; set; }
  42. /// <summary>
  43. /// 是否使用SSL
  44. /// </summary>
  45. [Category("1.邮件服务器")]
  46. [Description("是否使用安全的SSL发送,默认为false")]
  47. public bool EnableSSL { get; set; }
  48. /// <summary>
  49. /// 发送者名称
  50. /// </summary>
  51. [Category("2.发送人信息")]
  52. [Description("邮件中发信者的名称")]
  53. public string SendUserName { get; set; }
  54. /// <summary>
  55. /// 送信者邮件
  56. /// </summary>
  57. [Category("2.发送人信息")]
  58. [Description("邮件发信人的具体邮件地址")]
  59. public string SendEmail { get; set; }
  60. /// <summary>
  61. /// 送信者的邮件密码
  62. /// </summary>
  63. [PasswordPropertyText(true)]
  64. [Category("2.发送人信息")]
  65. [Description("邮件发信人的具体邮件访问密码")]
  66. public string SendEmailPassword { get; set; }
  67. public object Clone()
  68. {
  69. return (EmailServerInfo)this.MemberwiseClone();
  70. }
  71. public override string ToString()
  72. {
  73. return "邮件服务器信息";
  74. }
  75. }
  76. }