當前位置: 首頁>>代碼示例>>PHP>>正文


PHP mailer::sendMail方法代碼示例

本文整理匯總了PHP中mailer::sendMail方法的典型用法代碼示例。如果您正苦於以下問題:PHP mailer::sendMail方法的具體用法?PHP mailer::sendMail怎麽用?PHP mailer::sendMail使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在mailer的用法示例。


在下文中一共展示了mailer::sendMail方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: sendAlert

 /**
  * 
  * @access public
  * @param id
  * 
  */
 public function sendAlert($id)
 {
     $mail = new mailer();
     $user = new users();
     // send alert email !
     $row = $user->getUser($id);
     $emailTo = $row['user'];
     $to[] = $emailTo;
     $subject = "Alert: Hours spent have exceeded planned hours";
     $mail->setSubject($subject);
     $text = "Hello " . $emailTo . ",\n\t\t\t\t\t\t\t\t\n\t\t\tThis is a friendly reminder that you have surpassed\n\t\t\t\t\t\t\t\t\n\t\t\tthe estimated hours for this project. While we \n\t\t\t\t\t\t\t\t\t\n\t\t\tunderstand it is impossible to meet every deadline\n\t\t\t\t\t\t\t\t\t\n\t\t\twe encourage you to be as diligent as possible with\n\t\t\t\t\t\t\t\t\t\n\t\t\tyour workload.";
     $mail->setText($text);
     $mail->sendMail($to);
 }
開發者ID:kellan04,項目名稱:leantime,代碼行數:20,代碼來源:class.tickets.php

示例2: setHeaders

        header($_SERVER['SERVER_PROTOCOL'] . ' 500 Internal Server Error', true, 500);
        print_r($this);
        die('There was an error in processing your request. Please contact us at XXX-XXX-XXXX for further assistance.');
    }
    protected function setHeaders()
    {
        $headers[] = "Content-type: text/plain; charset=iso-8859-1";
        $headers[] = "From: webmaster@example.com";
        $headers[] = "Reply-To: webmaster@example.com";
        $headers[] = "Subject: {$this->subject}";
        $headers[] = "X-Mailer: PHP/" . phpversion();
        $this->headers = implode('\\r\\n', $headers);
    }
    protected function setSubject()
    {
        $this->subject = $this->name . ' is interested in purchasing property!';
    }
    protected function setMessage()
    {
        $this->message = $this->name . ' heard about us recently from (' . $this->option . ')
                                        and would like to look into our services to purchase
                                        a home! They have a budget of $' . $this->budget . ' 
                                        and can be contacted at the following:
                                        ' . $this->address1 . ' 
                                        ' . $this->address2 . ' 
                                        ' . $this->city . ', ' . $this->state . ' ' . $this->zip;
    }
}
$mailer = new mailer();
$mailer->sendMail();
開發者ID:singe-nu-fou,項目名稱:pet-project,代碼行數:30,代碼來源:tech3-2.php


注:本文中的mailer::sendMail方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。