<?php
/**
 * ------------------------ 
 *  版权所有  www.tecmz.com
 *  商业版本请购买正版授权使用
 * ------------------------
*/ namespace Module\Edm\Provider\Sender; use Illuminate\Support\Facades\Log; use ModStart\Core\Input\Response; use ModStart\Support\Concern\HasFields; class SmtpEdmMailSenderProvider extends AbstractEdmMailSenderProvider { public function name() { return 'smtp'; } public function title() { return 'SMTP'; } public function buildParam($JeXgT) { goto JHFDl; iNPh8: $JeXgT->text('param5', '用户名称')->help('发送邮件时显示的发件人名称'); goto P2Fjd; DVyTw: $JeXgT->text('param4', 'SMTP密码'); goto iNPh8; kX8xQ: $JeXgT->text('param3', 'SMTP用户'); goto DVyTw; NW9OI: $JeXgT->switch('param2', '启用SSL'); goto kX8xQ; JHFDl: $JeXgT->text('param1', 'SMTP服务器'); goto NW9OI; P2Fjd: } public function send($BRQsA, $ber3G, $UFLoy, $Ral1i, $FRVtF = array()) { goto SrIg0; aOCXd: $G3MVG = (new \Swift_SmtpTransport($BRQsA['param1'], $AAQC5))->setUsername($BRQsA['param3'])->setPassword($BRQsA['param4']); goto FHkLv; pOCeQ: $QVCez = new \Swift_Mailer($G3MVG); goto olygx; olygx: $G0GGq = (new \Swift_Message())->setFrom(array($BRQsA['param3'] => $BRQsA['param5']))->setTo(array($ber3G))->setSubject($UFLoy)->setBody($Ral1i, 'text/html'); goto Xu2Gj; FHkLv: if ($BRQsA['param2']) { $G3MVG->setEncryption('ssl'); } goto pOCeQ; SrIg0: $AAQC5 = $BRQsA['param2'] ? 465 : 25; goto aOCXd; Xu2Gj: try { goto mVhfS; bAM59: return Response::generateError('发送失败'); goto Fju4B; mVhfS: $seqlj = $QVCez->send($G0GGq); goto GCD3R; GCD3R: if ($seqlj > 0) { return Response::generateSuccess(); } goto bAM59; Fju4B: } catch (\Exception $re7gC) { return Response::generateError('发送失败:' . $re7gC->getMessage()); } goto ZCjp8; ZCjp8: } }