{{template "header.tmpl" .}}
</head>
<body>
{{template "navbar.tmpl" .}}

<div class="container-fluid">
	<h4 class="text-center">邮件发送测试</h4>
	<hr />
	<div class="row">
		<div class="col-md-4 col-md-offset-4">
			<div class="pannel">
				<div class="pannel_body">
					<form id="mainform">
						<div class="form-group">
							<label>收件人(多个之间使用;间隔)</label>
							<input type="text" class="form-control" name="sendto" value="" maxlength="100" />
						</div>
						<div class="form-group">
							<label>标题</label>
							<input type="text" class="form-control" name="title" value="" maxlength="50" />
						</div>
						<div class="form-group">
							<label>内容</label>
							<textarea rows="5" name="content" class="form-control"></textarea>
						</div>
						<button class="btn btn-sm btn-primary">发送</button>
						<a class="btn btn-sm btn-default" href="/syscfg/warn">返回SMTP设置</a>
					</form>
				</div>
			</div>
		</div>
	</div>
</div>

<script type="text/javascript">
var $SESS = {{.Sess}};
$(function(){
	$('#mainform').submit(function(){
		if (this.sendto.value == '') {
			$.alert({'content': '收件人不能为空！'});
		} else if (this.title.value == '') {
			$.alert({'content': '标题不能为空！'});
		} else if (this.content.value == '') {
			$.alert({'content': '发送内容不能为空！'});
		} else {
			$.post('/debug/sendmail', $(this).serialize(), function(resp){
				if (resp.errno) {
					$.alert({'content': resp.error});
				} else {
					$.alert({'content': '操作成功！'});
				}
			}, 'json');
		}
		return false;
	});
});
</script>
</body>
</html>