using System.Web.Mvc;
using System.Linq;

using Bitlab.EmailFeedback;

namespace Bitlab.EmailFeedback.Web.Portal // or .Web.Management
{

    using Rhythm;
    using Rhythm.Web.Portal;    //using Rhythm;
    using System;
    /// <summary>
    /// 群众路线活动专栏 控制器
    /// </summary>
   // [AuthorizeIsAuthenticated]
    public class EmailFeedbackController : PortalControllerBase
    {
        public ActionResult Edit()
        {
            return View(EmailFeedbackConfiguration.Configuration);

        }

        [HttpPost]
        public ActionResult Edit(EmailFeedbackConfiguration substratumVoiceFeedback)
        {
             ConfigurationService.Instance.UpdateConfiguration(substratumVoiceFeedback);
            return Success("保存成功").Refresh();
        }

    }
}






/// <summary>
/// 收件人
/// </summary>
/// 

public class EmailAddressInfo
{
  /// <summary>
  /// 别名
  /// </summary>
  //[Required]
  public string DisplayName { get; set; }
  /// <summary>
  /// 邮箱地址
  /// </summary>
  [Required]
  [DataType(System.ComponentModel.DataAnnotations.DataType.EmailAddress)]
  //[RegularExpression(@"\w+@[a-zA-Z_]+?\.[a-zA-Z]{2,3}", ErrorMessage = "邮箱格式不正确")]
  public string Address { get; set; }

  /// <summary>
  /// 邮箱服务器ip或域名
  /// </summary>
  [System.ComponentModel.DataAnnotations.Display(Name = "邮箱服务器")]
  //[Required]
  public string SmtpServerIp { get; set; }

  /// <summary>
  /// 端口号
  /// </summary>
  [System.ComponentModel.DataAnnotations.Display(Name = "端口号")]
  //[Required]
  public int? SmtpServerPort { get; set; }

  /// <summary>
  /// 发件箱用户名
  /// </summary>
  [System.ComponentModel.DataAnnotations.Display(Name = "发件箱用户名")]
  //[Required]
  public string SmtpUsername { get; set; }

  /// <summary>
  /// 发件箱密码
  /// </summary>
  [System.ComponentModel.DataAnnotations.Display(Name = "发件箱密码")]
  //[Required]
  public string SmtpPassword { get; set; }


}



/// <summary>
/// 基层之声邮箱配置
/// </summary>
public class EmailFeedbackConfiguration : ConfigurationBase<EmailFeedbackConfiguration>
{
 
  /// <summary>
  /// 提示信息
  /// </summary>
  [System.ComponentModel.DataAnnotations.Display(Name = "提示信息")]
  [StringLength(200)]
  public string UserNotify { get; set; }

  /// <summary>
  /// 收件人
  /// </summary>
  [System.ComponentModel.DataAnnotations.Display(Name = "收件人")]
  public IList<EmailAddressInfo> ToEmails { get; set; }

  /// <summary>
  /// 抄送
  /// </summary>
  [System.ComponentModel.DataAnnotations.Display(Name = "抄送")]
  public string CCEmails { get; set; }

  ///// <summary>
  ///// 邮箱后缀
  ///// </summary>
  //[System.ComponentModel.DataAnnotations.Display(Name = "邮箱后缀")]
  //[Required]
  //public string FromDomain { get; set; }


  /// <summary>
  /// 发件人
  /// </summary>
  [System.ComponentModel.DataAnnotations.Display(Name = "发件人")]
  [Required]
  public EmailAddressInfo From { get; set; }

  /// <summary>
  /// 是否使用 HTML 格式发送邮件
  /// </summary>
  [System.ComponentModel.DataAnnotations.Display(Name = "是否使用 HTML 格式发送邮件")]
  public bool IsBodyHtml { get; set; }

  /// <summary>
  /// 邮件内容格式
  /// </summary>

  [System.ComponentModel.DataAnnotations.Display(Name = "邮件内容格式")]
  [DataType(DataType.Html)]
  public string EmailBodyFormat { get; set; }

  /// <summary>
  /// 邮件主题格式
  /// </summary>
  [System.ComponentModel.DataAnnotations.Display(Name = "邮件主题格式")]
  public string EmailSubjectFormat { get; set; }
  //carbon copy (CC) recipients

  public string ToString(string format, IFormatProvider formatProvider)
  {
    return "";
  }




}




// 获取当前系统配置信息
EmailFeedbackConfiguration.Configuration

 

 

 

发表评论

您的电子邮箱地址不会被公开。