<?php
/**
 * ------------------------ 
 *  版权所有  www.tecmz.com
 *  商业版本请购买正版授权使用
 * ------------------------
*/ namespace Module\EmailSmtp\Admin\Controller; use Illuminate\Routing\Controller; use Illuminate\Support\Facades\View; use ModStart\Admin\Layout\AdminConfigBuilder; use ModStart\Core\Input\Response; use ModStart\Form\Form; use Module\EmailSmtp\Provider\SmtpMailSenderProvider; class ConfigController extends Controller { public function setting(AdminConfigBuilder $P2vse) { goto fZ0x2; vGwQA: $P2vse->switch('systemEmailSmtpSsl', 'SMTP是否为SSL'); goto aC1Ua; VhSVR: $P2vse->text('systemEmailSmtpPassword', 'SMTP密码'); goto AJZv4; AJZv4: $P2vse->formClass('wide'); goto VjlJi; VjlJi: return $P2vse->perform(); goto NtbDS; agEWw: $P2vse->switch('systemEmailEnable', '开启SMTP邮件发送'); goto SKEqH; fZ0x2: $P2vse->pageTitle('SMTP邮箱设置'); goto agEWw; SKEqH: $P2vse->text('systemEmailSmtpServer', 'SMTP服务器地址'); goto vGwQA; aC1Ua: $P2vse->text('systemEmailSmtpUser', 'SMTP用户'); goto VhSVR; NtbDS: } public function test(AdminConfigBuilder $P2vse) { goto o5kTb; f9tDE: $P2vse->text('email', '测试接收邮箱')->rules('required'); goto rOTyN; rOTyN: $P2vse->formClass('wide'); goto w9Y3S; w9Y3S: return $P2vse->perform(null, function (Form $NX6uw) { $avcnU = $NX6uw->dataForming(); $ww4tY = $avcnU['email']; $l4yXH = new SmtpMailSenderProvider(); $ybjC4 = View::make('module::EmailSmtp.View.mail.test', array())->render(); $rhLXE = $l4yXH->send($ww4tY, $ww4tY, '测试邮件', $ybjC4, array()); if (Response::isError($rhLXE)) { return Response::generateError('邮件发送失败：' . $rhLXE['msg']); } return Response::generateSuccess('测试邮件成功发送到' . $ww4tY); }); goto O2Y08; o5kTb: $P2vse->pageTitle('邮件发送测试'); goto f9tDE; O2Y08: } }