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


PHP Mail::failures方法代码示例

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


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

示例1: handle

 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function handle()
 {
     $event = DB::table('orders')->join('users', 'users.email', '=', 'orders.custID')->select('users.*', 'orders.DueDate AS chkDate', 'orders.ordID AS id', 'orders.ordDate', 'DueDate AS chkDate', 'orders.status AS status')->get();
     foreach ($event as $eve) {
         //Get orders which have passed the dealine and are ongoing and orders which are closing the deadline.
         if (Carbon::today()->addDays(2)->eq(Carbon::parse($eve->chkDate)) or Carbon::today()->addDays(1)->eq(Carbon::parse($eve->chkDate)) or Carbon::today()->eq(Carbon::parse($eve->chkDate))) {
             $dDateArr[]['dLineIDs'] = $eve->id;
         } elseif (Carbon::today()->subDay()->gte(Carbon::parse($eve->chkDate)) and $eve->status == 'Ongoing') {
             $dDateArr[]['passIDs'] = $eve->id;
         }
     }
     $msg = '<h3>The following orders need your attention:- </h3><ul>';
     foreach ($dDateArr as $dets) {
         if (isset($dets['dLineIDs'])) {
             $msg .= '<li>The Order ID' . $dets['dLineIDs'] . 'is reaching the deadline.</li>';
         }
         if (isset($dets['passIDs'])) {
             $msg .= '<li>The Order ID' . $dets['passIDs'] . ' has passed the deadline.</li>';
         }
     }
     $msg .= '</ul>';
     if (isset($dDateArr)) {
         Mail::send(array(), array(), function ($message) use($msg) {
             $message->from('paintbuddyProj@gmail.com', 'Admin System');
             $message->to('paintbuddyProj@gmail.com');
             $message->subject('Urgent:Alert');
             $message->setBody($msg, 'text/html');
         });
         if (count(Mail::failures()) == 0) {
             echo 'Artist has been successfully alerted at ' . Carbon::now();
         }
     }
 }
开发者ID:Legolas000,项目名称:PaintBuddy,代码行数:38,代码来源:SendAlert.php

示例2: send

 public function send(Collection $data)
 {
     $validator = $this->validator($data->toArray(), $this->type);
     if (!$validator->fails()) {
         Mailer::send("emails.{$this->type}", $data->toArray(), function ($message) use($data) {
             $fromAddress = $data->get('from_address');
             $fromName = $data->get('from_name');
             $toAddress = $data->get('to_address');
             $toName = $data->get('to_name');
             $cc = $data->get('cc[]', []);
             $bcc = $data->get('bcc[]', []);
             // Send the message
             $message->from($fromAddress, $fromName);
             $message->to($toAddress, $toName)->subject($data->get('subject'));
             foreach ($cc as $address) {
                 $message->cc($address, null);
             }
             foreach ($bcc as $address) {
                 $message->bcc($address, null);
             }
         });
     } else {
         // Validation failed
         return ['success' => 0, 'status' => "Failed to validate message", 'messages' => $validator->getMessageBag()->all(), 'data' => $data, 'type' => $this->type];
     }
     if (!count(Mailer::failures())) {
         $this->sent_at = Carbon::now();
         Log::info("Sent {$this->type} email");
         return ['success' => 1, 'status' => "successfully sent message", 'data' => $data, 'type' => $this->type];
     }
     Log::info("Failed to send {$this->type} email");
     return ['success' => 0, 'status' => "failed to send message", 'messages' => "failed to send message", 'data' => $data, 'type' => $this->type];
 }
开发者ID:wdmtech,项目名称:laravel-mail,代码行数:33,代码来源:Mail.php

示例3: sendConfirmationEmail

 /**
  * @param $user
  * @return bool
  * @throws GeneralException
  */
 public function sendConfirmationEmail($user)
 {
     //$user can be user instance or id
     if (!$user instanceof User) {
         $user = $this->find($user);
     }
     Mail::send('frontend.auth.emails.confirm', ['token' => $user->confirmation_code], function ($message) use($user) {
         $message->to($user->email, $user->name)->subject(app_name() . ': ' . trans('exceptions.frontend.auth.confirmation.confirm'));
     });
     if (count(Mail::failures()) > 0) {
         throw new GeneralException("There was a problem sending the confirmation e-mail");
     }
     return true;
 }
开发者ID:blomdahldaniel,项目名称:laravel-5-boilerplate,代码行数:19,代码来源:EloquentUserRepository.php

示例4: sendMail

 public function sendMail()
 {
     $dets = array('msg' => Request::input('mailDets'), 'subject' => Request::input('subjectH'), 'to' => Request::input('toH'), 'file' => Request::file('file'));
     $rules = array('msg' => 'required', 'subject' => 'required', 'to' => 'required|email');
     $messages = array('msg.required' => 'The email body is required', 'to.required' => 'The recipient\'s address is required', 'to.email' => 'The recepient address is not of the correct format');
     $validator = Validator::make($dets, $rules, $messages);
     if ($validator->fails()) {
         // send back to the page with the input data and errors
         return Redirect::back()->withInput()->withErrors($validator);
     } else {
         //Get the details from the form and send it as an array to the function.
         try {
             Mail::send(array(), array(), function ($message) use($dets) {
                 $message->from('paintbuddyProj@gmail.com', 'PaintBuddy Team');
                 $message->to($dets['to']);
                 $message->subject($dets['subject']);
                 $message->setBody($dets['msg'], 'text/html');
                 if (isset($dets['file'])) {
                     $message->attach(Request::file('file'), ['as' => Request::file('file')->getClientOriginalName(), 'mime' => Request::file('file')->getClientOriginalExtension()]);
                 }
             });
         } catch (\Exception $e) {
             throw new SendMailException($e->getMessage());
         }
         if (count(Mail::failures()) > 0) {
             return Redirect::back()->withInput()->withErrors('Mail was not sucessfully sent. Please try again');
         } else {
             return Redirect::back()->with('success', true)->with('message', 'Mail sucessfully sent');
         }
     }
 }
开发者ID:Legolas000,项目名称:PaintBuddy,代码行数:31,代码来源:ArtsMailController.php

示例5: sendTemplate

 public static function sendTemplate($path, $params, $locale = null)
 {
     if (!isset($params[self::EMAIL_FROM])) {
         $params[self::EMAIL_FROM] = appEmail();
     }
     if (!isset($params[self::EMAIL_FROM_NAME])) {
         $params[self::EMAIL_FROM_NAME] = appName();
     }
     if (!isset($params[self::EMAIL_SUBJECT])) {
         $params[self::EMAIL_SUBJECT] = trans('label.message_from_') . appName();
     }
     if (!isset($params[self::EMAIL_TO])) {
         return false;
     }
     if (!empty($locale)) {
         $params['site_locale'] = $locale;
     }
     $locale = $params['site_locale'];
     try {
         Mail::send('emails.' . $path . '.' . $locale, $params, function ($message) use($params) {
             $message->from($params[MailHelper::EMAIL_FROM], $params[MailHelper::EMAIL_FROM_NAME]);
             $message->subject($params[MailHelper::EMAIL_SUBJECT]);
             if (isset($params[MailHelper::EMAIL_TO_NAME])) {
                 $message->to($params[MailHelper::EMAIL_TO]);
             } else {
                 $message->to($params[MailHelper::EMAIL_TO], $params[MailHelper::EMAIL_TO_NAME]);
             }
         });
         return count(Mail::failures()) > 0;
     } catch (\Exception $ex) {
         return false;
     }
 }
开发者ID:linhntaim,项目名称:katniss,代码行数:33,代码来源:MailHelper.php

示例6: sendMail

 protected function sendMail($input)
 {
     $data = ['user' => Auth::user(), 'title' => Lang::get('c::support.subject')] + $input;
     if (!Config::get('c::support-email')) {
         throw new \RuntimeException('Cannot send support e-mail - c::support-email config value is empty');
     }
     Mail::send('c::support.mail', $data, function ($msg) {
         $msg->to(Config::get('c::support-email'))->subject(Lang::get('c::support.subject'));
     });
     return count(Mail::failures()) == 0;
 }
开发者ID:anlutro,项目名称:l4-core,代码行数:11,代码来源:SupportController.php

示例7: sendMail

 /**
  * Sends an email
  *
  * @param string $template Template name
  * @param array $data Email data. Must contain
  * @example
  * [
  *  'mail_to' => <recipient email address>,
  *  'recipient_name' => <recipient_name>,
  *  'mail_from' => <sender_address>,
  *  'sender_name' => <sender_name>,
  *  'subject' => <email_subject>
  * ]
  * @return bool
  */
 public function sendMail($template, array $data)
 {
     Mail::send($template, $data, function ($msg) use($data) {
         $msg->to($data['mail_to'], $data['recipient_name']);
         $msg->from($data['mail_from'], $data['sender_name']);
         $msg->replyTo($data['mail_from'], $data['sender_name']);
         $msg->subject($data['subject']);
     });
     // Check for email failures
     if (count(Mail::failures()) > 0) {
         return false;
     }
     return true;
 }
开发者ID:Denniskevin,项目名称:Laravel5Starter,代码行数:29,代码来源:SendMail.php

示例8: mailer

 protected function mailer($confirmation_url, $email_to, $name_to)
 {
     $this->confirmation_params['confirmation_url'] = $confirmation_url;
     $this->email_to = $email_to;
     $this->name_to = $name_to;
     Mail::send($this->views, $this->confirmation_params, function ($message) {
         $message->subject($this->subject);
         $message->from($this->email_from, $this->name_from);
         $message->to($this->email_to, $this->name_to);
     });
     if (count(Mail::failures()) > 0) {
         return false;
     }
     return true;
 }
开发者ID:omar3f,项目名称:laravel-demo,代码行数:15,代码来源:EmailSender.php

示例9: sendMail

 /**
  * Function to send emails to the user and to the admin.
  * The input array must be in the following format
  * [
  *  'user_email' => '',
  *  'username' => '',
  *  'user_subject' => '',
  *  'admin_subject' => '',
  *  'user_email_text' => '',
  *  'admin_mail_text' =>
  * ]
  *
  * @param Array $data Data to use for the emails
  * @param string $user_template User email template
  * @param string $admin_template Admin email template
  * @return boolean
  */
 protected function sendMail($data, $user_template, $admin_template)
 {
     // Send user email
     Mail::send($user_template, $data, function ($msg) use($data) {
         $msg->to($data['user_email'], $data['username']);
         $msg->from(Config::get('mail.from.address'), Config::get('mail.from.name'));
         $msg->subject($data['user_subject']);
     });
     // Check for email failures
     if (count(Mail::failures()) > 0) {
         return false;
     }
     // Send admin email
     Mail::send($admin_template, $data, function ($msg) use($data) {
         $msg->to(Config::get('mail.from.address'), Config::get('mail.from.name'));
         $msg->from($data['user_email'], $data['username']);
         $msg->subject($data['admin_subject']);
     });
     // Check for email failures
     if (count(Mail::failures()) > 0) {
         return false;
     }
     return true;
 }
开发者ID:elberthcabrales,项目名称:Laravel5Starter,代码行数:41,代码来源:Controller.php

示例10: reply

 /**
  * Reply feedback to sender via email.
  *
  * @param $id
  * @param $name
  * @param $email
  * @param $message
  * @param $reply
  * @return bool
  */
 public function reply($id, $name, $email, $message, $reply)
 {
     $data = ['name' => $name, 'feedback' => $message, 'reply' => $reply];
     Mail::send('emails.admin.feedback', $data, function ($message) use($id, $name, $email) {
         $message->from('no-reply@infogue.id', 'Infogue.id');
         $message->replyTo('no-reply@infogue.id', 'Infogue.id');
         $message->to($email)->subject('Reply feedback ticket #' . $id);
     });
     return Mail::failures();
 }
开发者ID:anggadarkprince,项目名称:infogue,代码行数:20,代码来源:Feedback.php

示例11: send

 /**
  * @param              $rp_id
  * @param array        $data
  * @param array|string $profiles
  *
  * @return bool
  */
 public function send($rp_id, array $data = [], $profiles = [])
 {
     $this->setSender();
     $this->setReceivers($profiles);
     $this->emailsByProduct($rp_id);
     $user = $this->user;
     $data['rp_id'] = $rp_id;
     $this->setHtml($data);
     Mail::send('emails.layout', ['html' => $this->html], function ($message) use($user) {
         $message->from($this->sender['email'], $this->sender['name']);
         $message->subject($this->sender['name'] . '. ' . $this->subject);
         foreach ($this->customEmails as $customEmail) {
             $message->to($customEmail);
         }
         foreach ($this->receivers as $key => $receiver) {
             $message->to($receiver['email'], $receiver['name']);
         }
         foreach ($this->emails as $email) {
             $message->cc($email->email, $email->name);
         }
     });
     if (count(Mail::failures()) > 0) {
         // dd(Mail::failures);
         return false;
     }
     return true;
 }
开发者ID:sibasbo,项目名称:sibas,代码行数:34,代码来源:MailController.php


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