コード例 #1
0
ファイル: Email_Model.php プロジェクト: karyamedia/karya
 public function nette($from, $email, $subject, $content)
 {
     $mail = new Message();
     $mail->setFrom($from)->addTo($email)->setSubject($subject)->setHtmlBody($content);
     $mailer = new Nette\Mail\SmtpMailer(array('host' => getenv('NETTE_EMAIL_HOST') ?: '', 'smtp_port' => getenv('NETTE_EMAIL_PORT') ?: '25', 'username' => getenv('NETTE_EMAIL_USERNAME') ?: '', 'password' => getenv('NETTE_EMAIL_PASSWORD') ?: '', 'secure' => getenv('NETTE_EMAIL_SECURE') ?: 'ssl'));
     $mailer->send($mail);
 }
コード例 #2
0
ファイル: BaseAction.php プロジェクト: sky-L/task
 /**
  * 发送邮件
  */
 public function mail()
 {
     $mail = new Message();
     $mail->addTo("*****@*****.**");
     $mail->setSubject("hello world");
     $mailer = new \Nette\Mail\SmtpMailer(require BASE_PATH . "/config/mail.php");
     $mailer->send($mail);
 }
コード例 #3
0
ファイル: HomeController.php プロジェクト: badaozhai/bdzmvc
 public function mail()
 {
     $mail = Mail::to(['*****@*****.**', '*****@*****.**'])->from('M**********r <*****@*****.**>')->title('F**k Me!')->content('<h1>Hello~~</h1>');
     if ($mail instanceof Mail) {
         $mailer = new Nette\Mail\SmtpMailer($mail->config);
         $mailer->send($mail);
     }
 }
コード例 #4
0
ファイル: App.php プロジェクト: Piou-piou/ribs-framwork
 /**
  * @param $from
  * @param $to
  * @param $sujet
  * @param $message
  */
 public static function envoyerMail($from, $to, $sujet, $message)
 {
     $mail = new \Nette\Mail\Message();
     $mail->setFrom($from)->addTo($to)->setSubject($sujet)->setHtmlBody($message);
     if (SMTP_HOST != "") {
         $mailer = new \Nette\Mail\SmtpMailer(['host' => SMTP_HOST, 'username' => SMTP_USER, 'password' => SMTP_PASS, 'secure' => SMTP_SECURE, 'port' => SMTP_PORT]);
     } else {
         $mailer = new \Nette\Mail\SmtpMailer();
     }
     $mailer->send($mail);
 }
コード例 #5
0
ファイル: BaseController.php プロジェクト: leezhxing/mffc
 public function __destruct()
 {
     $view = $this->view;
     if ($view instanceof View) {
         extract($view->data);
         require $view->view;
     }
     $mail = $this->mail;
     if ($mail instanceof Mail) {
         $mailer = new Nette\Mail\SmtpMailer($mail->config);
         $mailer->send($mail);
     }
 }
コード例 #6
0
ファイル: api.php プロジェクト: bahuma20/gh-mittagessen
    $mailSubscriptions = MailSubscription::getAll();
    $receivers = array();
    foreach ($mailSubscriptions as $mailSubscription) {
        $receivers[] = User::getById($mailSubscription->getUser());
    }
    $mail = new Message();
    $mail->setFrom('Mittagessen Plattform <*****@*****.**>')->setSubject($user->getName() . ' holt Essen bei ' . $restaurant->getName())->setBody("Wenn du auch was willst, schaue auf " . $config['platform_url'] . "/app/#/offers/" . $offer->getId());
    foreach ($receivers as $receiver) {
        $mail->addTo($receiver->getEmail());
    }
    switch ($config['mail_method']) {
        case "sendmail":
            $mailer = new SendmailMailer();
            break;
        case "smtp":
            $mailer = new \Nette\Mail\SmtpMailer($config['smtpmail_settings']);
    }
    $mailer->send($mail);
    print "<html><pre>";
    print_r($receivers);
});
$app->get('/user/:id', function ($id) {
    outputJSON(User::getById($id));
});
$app->post('/auth/login', function () use($app) {
    $body = json_decode($app->request->getBody());
    try {
        $user = User::getByUsername($body->username);
        try {
            $user->login($body->password);
            if ($user) {
コード例 #7
0
ファイル: Email.php プロジェクト: xepan/communication
 function send(\xepan\communication\Model_Communication_EmailSetting $email_setting, $mailer = null)
 {
     $this['status'] = 'Outbox';
     $this['direction'] = 'Out';
     $this['mailbox'] = $email_setting['email_username'] . '#SENT';
     $this['description'] = $this['description'] . $email_setting['signature'];
     if (!$this['to_id']) {
         $this->findContact('to');
     }
     $this['communication_channel_id'] = $email_setting->id;
     if (!$this->app->getConfig('test_mode', false)) {
         try {
             $mail = new \Nette\Mail\Message();
             $mail->setFrom($this['from_raw']['email'], $this['from_raw']['name'] ?: null);
             $return_path = $email_setting['return_path'];
             if (!$return_path) {
                 $return_path = $this['from_raw']['email'];
             }
             $mail->setReturnPath($return_path);
             foreach ($this['to_raw'] as $to) {
                 $mail->addTo(trim($to['email']), $to['name'] ?: null);
             }
             if ($this['cc_raw']) {
                 foreach ($this['cc_raw'] as $cc) {
                     $mail->addCC(trim($cc['email']), $cc['name'] ?: null);
                 }
             }
             if ($this['bcc_raw']) {
                 foreach ($this['bcc_raw'] as $bcc) {
                     $mail->addBcc(trim($bcc['email']), $bcc['name'] ?: null);
                 }
             }
             foreach ($this->getAttachments() as $attach) {
                 $mail->addAttachment($_SERVER["DOCUMENT_ROOT"] . $attach);
             }
             $mail->setSubject($this['title'])->setHTMLBody($this['description'], $this->app->pathfinder->base_location->base_path);
             if (!$mailer) {
                 if (isset($this->app->mailer)) {
                     $mailer = $this->app->mailer;
                 } else {
                     $mailer = new \Nette\Mail\SmtpMailer(array('host' => $email_setting['email_host'], 'username' => $email_setting['email_username'], 'password' => $email_setting['email_password'], 'secure' => $email_setting['encryption'], 'persistent' => true));
                     $this->app->mailer = $mailer;
                 }
             }
             $mailer->send($mail);
             $email_setting['last_emailed_at'] = $this->app->now;
             $email_setting['email_sent_in_this_minute'] = $email_setting['email_sent_in_this_minute'] + 1;
             $email_setting->save();
         } catch (\Exception $e) {
             $this->save();
             throw $e;
         }
     }
     if ($this->app->getConfig('test_mode', false)) {
         // echo "setting last_emailed_at on ". $email_setting['name']. ' as '. $this->app->now . '<br/>';
         $email_setting['last_emailed_at'] = $this->app->now;
         $email_setting['email_sent_in_this_minute'] = $email_setting['email_sent_in_this_minute'] + 1;
         $email_setting->save();
     }
     $this['status'] = 'Sent';
     $this->save();
 }
コード例 #8
0
ファイル: jianshu.php プロジェクト: falconchen/JianshuDaily
        continue;
    }
    $content = new Develpr\Phindle\Content();
    $content->setTitle($article['title']);
    $content->setHtml('<meta http-equiv="Content-Type" content="text/html;charset=utf-8">' . "<h3>{$article['title']}</h3>" . $article['content']);
    $content->setPosition($i);
    $phindle->addContent($content);
}
$phindle->process();
$ebook_path = $phindle->getMobiPath();
$mail = new Nette\Mail\Message();
$mail->setFrom(sprintf('%s <%s>', $config['KD_SENDER']['from'], $config['KD_SENDER']['username']))->setSubject($phindle->getAttribute('title'))->addAttachment($ebook_path, null, 'application/octet-stream');
foreach ($config['KD_RECEIVER'] as $receiver) {
    $mail->addTo($receiver);
}
$mailer = new Nette\Mail\SmtpMailer($config['KD_SENDER']);
$result = $mailer->send($mail);
//获取图片本地存储路径
function get_image_filename($url, $local_prefix = "")
{
    $arr = parse_url($url);
    $basename = basename($arr['path']);
    if (strpos($basename, '.') === false) {
        return $local_prefix . $basename . '.jpg';
    } else {
        return $local_prefix . $basename;
    }
}
//下载图片
function download($url, $store_dir)
{
コード例 #9
0
ファイル: Mail.php プロジェクト: chenjiantan/TinyLara
 public function send()
 {
     $mailer = new Nette\Mail\SmtpMailer($this->config);
     $mailer->send($this);
 }
コード例 #10
0
ファイル: Mail.php プロジェクト: framework4php/framework
 public function send($config = array())
 {
     $this->config = array_merge($this->config, $config);
     $mailer = new Nette\Mail\SmtpMailer($this->config);
     $mailer->send($this);
 }