当前位置: 首页>>代码示例>>PHP>>正文


PHP Mailer::addAddress方法代码示例

本文整理汇总了PHP中Mailer::addAddress方法的典型用法代码示例。如果您正苦于以下问题:PHP Mailer::addAddress方法的具体用法?PHP Mailer::addAddress怎么用?PHP Mailer::addAddress使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Mailer的用法示例。


在下文中一共展示了Mailer::addAddress方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: MySend

 public static function MySend($array)
 {
     global $INI, $app;
     if (isset($INI["mailserver"]) && $INI["mailserver"]) {
         $mailer = new Mailer();
         $mailer->isSMTP();
         $mailer->SMTPOptions = ['ssl' => ['verify_peer' => false, 'verify_peer_name' => false, 'allow_self_signed' => true]];
         $mailer->Host = $INI["mailserver"];
         if (isset($INI["maildebug"]) && $INI["maildebug"]) {
             $mailer->SMTPDebug = 2;
         }
         if (isset($INI["mailuser"]) && $INI["mailuser"] && isset($INI["mailpwd"]) && $INI["mailpwd"]) {
             $mailer->SMTPAuth = true;
             $mailer->Username = $INI["mailuser"];
             $mailer->Password = $INI["mailpwd"];
             $mailer->Port = $INI["mailport"];
         }
         $mailer->isHTML(true);
         if (is_array($array["from"])) {
             $mailer->setFrom($array["from"][0], $array["from"][1]);
         } else {
             $mailer->setFrom($array["from"]);
         }
         if (is_array($array["to"])) {
             $mailer->addAddress($array["to"][0], $array["to"][1]);
         } else {
             $mailer->addAddress($array["to"]);
         }
         if (isset($array["reply"])) {
             if (is_array($array["reply"])) {
                 $mailer->addReplyTo($array["reply"][0], $array["reply"][1]);
             } else {
                 $mailer->addReplyTo($array["reply"]);
             }
         }
         if (isset($array["bcc"])) {
             if (is_array($array["bcc"])) {
                 foreach ($array["bcc"] as $bcc) {
                     $mailer->addBCC($bcc);
                 }
             } else {
                 $mailer->addBCC($array["bcc"]);
             }
         }
         $mailer->Subject = $array["subject"];
         $mailer->Body = $array["body"];
         if (isset($array["attachments"])) {
             foreach ($array["attachments"] as $a) {
                 $mailer->addAttachment($a);
             }
         }
         $mailer->send();
     } else {
         if (isset($INI["maildebug"]) && $INI["maildebug"]) {
             $file = fopen($app->basePathname("cache/debug.txt"), "a");
             fwrite($file, "Sending to: " . join(" ; ", mklist($array["to"])));
             fwrite($file, "\n{$array['body']}\n----------\n");
             fclose($file);
         }
     }
 }
开发者ID:appsuite-com-au,项目名称:gossamer,代码行数:61,代码来源:mailer.php

示例2: _createBuyerMail

 /**
  * @param $seller
  * @param $pdf
  * @throws Exception
  * @throws phpmailerException
  */
 private function _createBuyerMail($buyer, medexchange_pdf_medorder_BuyerPDF $pdf)
 {
     $mail = new Mailer();
     $mail->Subject = 'Sie haben Artikel gekauft';
     $buyerObj = Factory::loadObject('user', $buyer);
     $mail->Body = "Hallo " . $buyerObj['userid'] . "\n\n";
     $mail->Body .= "es wurden Artikel von Ihnen gekauft. Bitte ueberpruefen Sie das Dokument im Anhang.\n\n";
     $mail->Body .= "Mit freundlichen Gruessen \n\nIhr medEXchange-Team";
     $mail->addAddress($buyerObj['email']);
     $mail->addAttachment($pdf->getPath());
     $mail->send();
 }
开发者ID:kafruhs,项目名称:fws,代码行数:18,代码来源:Model.php

示例3: json_encode

<?php

if (!isset($_POST['name'])) {
    die;
}
require __DIR__ . '/Validator.php';
require __DIR__ . '/Mailer.php';
$validator = new Validator();
if (!$validator->validate()) {
    echo json_encode(array('success' => 'false', 'errors' => $validator->getErrors()));
    die;
}
$mail = new Mailer();
$mail->addAddress("info@happysmugglers.com");
$msg = "\nHallo,<br /><br />\n\nHet contactformulier op uw website is ingevuld. Hieronder staan de ingevoerde gegevens:<br /><br />\n\n<table>";
if (isset($_POST['message'])) {
    $_POST['message'] = nl2br($_POST['message']);
}
foreach ($_POST as $key => $value) {
    if (is_array($value)) {
        $value = implode(", ", $value);
    }
    $msg .= "<tr>\n    <td>" . $key . "</td>\n    <td>" . $value . "</td>\n</tr>";
}
$msg .= "</table><br />";
$mail->setHTMLBody($msg);
if ($mail->send()) {
    echo json_encode(array('success' => true));
    exit;
}
echo json_encode(array('success' => false));
开发者ID:rapideinternet,项目名称:happysmuggler,代码行数:31,代码来源:handlecontact.php

示例4: resetPassword

 public function resetPassword()
 {
     $this->view = new HTMLView();
     if ($this->request->isPOST()) {
         $post = $this->request->postData();
         $user = new UserModel();
         if ($this->request->isQueryArgSet('token')) {
             if ($user->getUserForPasswordResetToken($this->request->queryArgValue('token'))) {
                 $user->password = @$post['password'];
                 if ($user->save()) {
                     $user->deletePasswordResetTokens();
                     $alert = new Alert(Alert::SUCCESS);
                     $alert->addMessage('Password Set, Please Login');
                 } else {
                     $alert = new Alert(Alert::ERROR);
                     $alert->addMessageArray($user->getErrors());
                 }
                 $this->view->includeTemplate('auth.reset-password.password', ['app_name' => AppConfig::getValue('app_name'), 'alert' => $alert]);
             } else {
                 AppController::redirect(RouteController::fqURL('resetPassword'), ['status' => 'token-expired']);
             }
         } else {
             if ($post['email'] && $user->find($post['email'], 'email')) {
                 $token = $user->getPasswordResetTokenData();
                 if ($token['last_email_timestamp'] <= Carbon::now()->subMinutes(pow(2, $token['email_attempts']))) {
                     $user->incrementPasswordResetEmailCount();
                     $link = addQueryParams(RouteController::fqURL('resetPassword'), ['token' => $token['token']]);
                     // Send Email
                     $mailer = new Mailer();
                     $mailer->setSubject('Password Reset Token');
                     $mailer->addAddress($user->email);
                     $mailer->includeHTMLTemplate('email.reset-password', ['link' => $link]);
                     $mailer->send();
                     // errors handled within
                     // Show Message
                     $alert = new Alert(Alert::SUCCESS);
                     $alert->addMessage('Email Sent');
                 } else {
                     $alert = new Alert(Alert::ERROR);
                     $alert->addMessage('Too Many Attempts, Please Try Again Later');
                 }
                 $this->view->includeTemplate('auth.reset-password.email', ['app_name' => AppConfig::getValue('app_name'), 'alert' => $alert]);
             } else {
                 $alert = new Alert(Alert::ERROR);
                 $alert->addMessage('Email is Invalid/Non-Existent');
                 $this->view->includeTemplate('auth.reset-password.email', ['app_name' => AppConfig::getValue('app_name'), 'alert' => $alert]);
             }
         }
     } else {
         if ($this->request->isQueryArgSet('token')) {
             $user = new UserModel();
             if ($user->getUserForPasswordResetToken($this->request->queryArgValue('token'))) {
                 $this->view->includeTemplate('auth.reset-password.password', ['app_name' => AppConfig::getValue('app_name')]);
             } else {
                 AppController::redirect(RouteController::fqURL('resetPassword'), ['status' => 'token-expired']);
             }
         } else {
             if ($this->request->isQueryArgSet('status') && $this->request->queryArgValue('status') == 'token-expired') {
                 $alert = new Alert(Alert::ERROR);
                 $alert->addMessage('Token is Invalid/Expired, Please Request a New One');
             }
             $this->view->includeTemplate('auth.reset-password.email', ['app_name' => AppConfig::getValue('app_name'), 'alert' => isset($alert) ? $alert : null]);
         }
     }
     $this->view->render(true);
 }
开发者ID:bitcalc,项目名称:allspark,代码行数:66,代码来源:authcontroller.php


注:本文中的Mailer::addAddress方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。