Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $mailer->AddAddress("aa@gmail.com");
- $mailer->AddAddress("aaa@gmail.com, bbbb@gmail.com");
- $mailer->AddAddress("'aaa@gmail.com', 'bbbb@gmail.com'");
- $mailer->AddAddress(""aaa@gmail.com", "bbbb@gmail.com"");
- $mailer->AddAddress("aaa@gmail.com");
- $mailer->AddAddress("bbbb@gmail.com");
- <?php
- Yii::import('application.extensions.PHPMailer_v5.1.*');
- class Mailer {
- private $mail;
- public function initialise() {
- try {
- require Yii::getPathOfAlias('application.extensions') . '/PHPMailer_v5.1/class.phpmailer.php';
- $this->mail = new PHPMailer(TRUE);
- $this->mail->IsSMTP(); // tell the class to use SMTP
- $this->mail->SMTPDebug = 0;
- $this->mail->SMTPAuth = true; // enable SMTP authentication
- $this->mail->Port = 25; // set the SMTP server port
- $this->mail->Host = "smtp.test.net"; // SMTP server
- $this->mail->Username = "test.com"; // SMTP server username
- $this->mail->Password = "test"; // SMTP server password
- $this->mail->Mailer = "smtp";
- $this->mail->From = 'info@test.com';
- $this->mail->FromName = 'test@net.com';
- } catch (Exception $e) {
- echo $e->getTraceAsString();
- }
- }
- public function email($message, $sendTo, $subject) {
- try {
- $this->mail->AddAddress($sendTo);
- $this->mail->Subject = $subject;
- $body = $message;
- $this->mail->MsgHTML($body);
- $this->mail->IsHTML(true); // send as HTML
- $this->mail->Send();
- $this->mail->ClearAllRecipients();
- } catch (Exception $e) {
- echo $e->getTraceAsString();
- }
- }
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement