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


PHP Mail::queue方法代码示例

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


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

示例1: email

 protected static function email($template, $title, $data, $receivers, $sender, $bcc = null, $file = null)
 {
     $data['app_name'] = Config::get('app.name');
     $data['base'] = Config::get('app.url');
     $data['title'] = $title;
     $data['receivers'] = $receivers;
     $data['user_name'] = $sender['name'];
     $data['user_email'] = $sender['email'];
     $data['bcc'] = (array) $bcc;
     $data['file'] = $file;
     $success = false;
     try {
         Log::info('<!> Sending new email...');
         Mail::queue('emails.' . $template, $data, function ($message) use($data) {
             $message->from($data['user_email'], $data['user_name'])->subject($data['app_name'] . ' - ' . $data['title']);
             if (!empty($data['receivers'])) {
                 $message->to($data['receivers']);
             }
             if (!empty($data['bcc'])) {
                 $message->bcc($data['bcc']);
             }
             if (!empty($data['file'])) {
                 $message->attach($data['file']);
             }
         });
         Log::info('...DONE!');
         // Log::info( json_encode($data) );
         $success = true;
     } catch (Exception $e) {
         Log::warning('<!!!> ...FAILED! Exception while sending email: ' . $e->getMessage());
     }
     return $success;
 }
开发者ID:jiqiang90,项目名称:laravel-restful-api-starter,代码行数:33,代码来源:EmailTrigger.php

示例2: sendEmail

 /**
  * @param string $email
  * @param string $error
  */
 private static function sendEmail($email, $error)
 {
     \Mail::queue('emails.optimise.error', ['error' => $error], function ($message) use($email) {
         $message->from(config('mail.from.address'), config('mail.from.name'));
         $message->to($email)->subject('Problems during optimisation');
     });
 }
开发者ID:dsd-meetme,项目名称:backend,代码行数:11,代码来源:ErrorListener.php

示例3: sendTo

 public function sendTo($email, $subject, $view, $data = array())
 {
     \Mail::queue($view, $data, function ($message) use($email, $subject) {
         $message->to($email)->subject($subject);
     });
     return "Mail has been sent";
 }
开发者ID:arikazukitomaharjan,项目名称:OfficeSystem,代码行数:7,代码来源:Mailer.php

示例4: sendTo

 public function sendTo($email, $subject, $fromEmail, $view, $data = [])
 {
     \Mail::queue($view, $data, function ($message) use($email, $subject, $fromEmail) {
         $message->from($fromEmail, 'tuts@codingo.me');
         $message->to($email)->subject($subject);
     });
 }
开发者ID:andela-sakande,项目名称:auth-with-roles,代码行数:7,代码来源:Mailer.php

示例5: create

 public function create($catalog_id)
 {
     $rules = array('images' => 'required');
     $validator = Validator::make(Input::all(), $rules);
     if ($validator->fails()) {
         return Redirect::route(array('admin.newsletter.create', $catalog_id))->withErrors($validator)->With(Input::all());
     } else {
         $catalog = Catalog::find($catalog_id);
         $pictures = $catalog->pictures;
         $car = $catalog->car;
         $images = Input::get('images');
         $newsletter = new Newsletter();
         $newsletter->title = $catalog->title;
         $newsletter->images = $images;
         $newsletter->send_to = 0;
         $newsletter->user_id = Auth::user()->id;
         $newsletter->catalog_id = $catalog_id;
         $newsletter->save();
         $settingsEmail = Settings::where('key', '=', 'contact_email')->first();
         $settingsEmailName = Settings::where('key', '=', 'contact_name')->first();
         // Subscribers::find(8001) for testing
         $subscribers = Subscribers::all();
         foreach ($subscribers as $subscriber) {
             $data = array('subject' => $catalog->title, 'to' => $subscriber->email, 'to_name' => $subscriber->name, 'from_name' => $settingsEmailName->value, 'from' => $settingsEmail->value, 'catalog' => $catalog, 'images' => $images, 'car' => $car, 'pictures' => $pictures, 'user' => $subscriber);
             Mail::queue('emails.newsletter.html', $data, function ($message) use($data) {
                 $message->to($data['to'], $data['to_name'])->from($data['from'], $data['from_name'])->subject($data['subject']);
             });
         }
         return Redirect::route('admin.newsletter.index')->with('success', Lang::get('messages.newsletter_created'));
     }
     return Redirect::route('admin.newsletter.index')->with('success', Lang::get('messages.newsletter_created'));
 }
开发者ID:stefferd,项目名称:me-consultancy,代码行数:32,代码来源:NewsletterController.php

示例6: postRegister

 public function postRegister(Request $request)
 {
     $validator = $this->validator($request->all());
     if ($validator->fails()) {
         $this->throwValidationException($request, $validator);
     }
     $activation_code = str_random(60) . $request->input('email');
     $user = new User();
     $user->username = $request->input('username');
     $user->name = $request->input('name');
     $user->lastname = $request->input('lastname');
     $user->birthdate = $request->input('birthdate');
     $user->email = $request->input('email');
     $user->password = bcrypt($request->input('password'));
     $user->activation_code = $activation_code;
     if ($user->save()) {
         $data = array('name' => $user->name, 'code' => $activation_code);
         \Mail::queue('emails.activateAccount', $data, function ($message) use($user) {
             $message->to($user->email, 'Please activate your account.');
         });
         return view('user.activateAccount');
     } else {
         Flash::message('Your account couldn\'t be create please try again');
         return redirect()->back()->withInput();
     }
 }
开发者ID:angebe,项目名称:CloudWac.github.io,代码行数:26,代码来源:AuthController.php

示例7: sendTo

 public function sendTo($email, $subject, $fromEmail, $view, $data = [])
 {
     \Mail::queue($view, $data, function ($message) use($email, $subject, $fromEmail) {
         $message->from($fromEmail, env('MAIL_USERNAME'));
         $message->to($email)->subject($subject);
     });
 }
开发者ID:VersoCore,项目名称:laravel-auth,代码行数:7,代码来源:Mailer.php

示例8: postReset

 public function postReset()
 {
     $this->beforeFilter('csrf');
     // Use the same password validation rules
     // from the user model
     $rules = array('code' => 'required', 'email' => 'required|email', 'password' => User::$rules['password'] . '|confirmed');
     $validator = Validator::make(Input::all(), $rules);
     if (!$validator->fails()) {
         try {
             $user = Sentry::findUserByCredentials(array('email' => Input::get('email')));
             if ($user->checkResetPasswordCode(Input::get('code'))) {
                 if ($user->attemptResetPassword(Input::get('code'), Input::get('password'))) {
                     // Password reset passed
                     Mail::queue(array('emails.password.done', 'emails.password.done_text'), array(), function ($message) use($user) {
                         $message->to($user->email, $user->first_name . ' ' . $user->last_name)->subject('Password Reset Successful');
                     });
                     return Redirect::action('AuthController@getDone');
                 } else {
                     // Password reset failed
                     Session::flash('error', 'Your password could not be reset');
                 }
             } else {
                 // The provided password reset code is Invalid
                 Session::flash('error', 'Invalid password reset code');
             }
         } catch (Cartalyst\Sentry\Users\UserNotFoundException $e) {
             Session::flash('error', 'User not found, please check your email address');
         }
     } else {
         Session::flash('error', 'Please correct the following errors and try again');
     }
     Input::flash();
     return Redirect::action('AuthController@getReset')->withErrors($validator);
 }
开发者ID:thomaswelton,项目名称:laravel,代码行数:34,代码来源:AuthController.php

示例9: postSignup

 /**
  * 	POST to create user account.
  */
 public function postSignup()
 {
     //Retrieve POST values
     $email = Input::get('email');
     $password = Input::get('password');
     $fname = Input::get('fname');
     $lname = Input::get('lname');
     $user_details = Input::all();
     //Rules for signup form submission
     $rules = array('email' => 'required|unique:users', 'password' => 'required', 'fname' => 'required', 'lname' => 'required');
     $validation = Validator::make($user_details, $rules);
     if ($validation->fails()) {
         return Response::json($this->growlMessage($validation->messages()->getMessages(), 'error'), 500);
     } else {
         //Create user token for email verification
         $token = str_random();
         //Create new user
         $user = new User();
         $user->email = $email;
         $user->password = Hash::make($password);
         $user->fname = $fname;
         $user->lname = $lname;
         $user->token = $token;
         $user->save();
         //Send email to user for email account verification
         Mail::queue('email.signup', array('token' => $token), function ($message) use($email, $fname) {
             $message->subject('Welcome to the Madison Community');
             $message->from('sayhello@opengovfoundation.org', 'Madison');
             $message->to($email);
             // Recipient address
         });
         return Response::json(array('status' => 'ok', 'errors' => array(), 'message' => 'An email has been sent to your email address.  Please follow the instructions in the email to confirm your email address before logging in.'));
     }
 }
开发者ID:austenpayan,项目名称:madison,代码行数:37,代码来源:UserManageApiController.php

示例10: postConfirmation

 /**
  * Handle a POST request to remind a user of their password.
  *
  * @return Response
  */
 public function postConfirmation()
 {
     // 3 error cases - user already confirmed, email does not exist, password not correct
     // (prevents people from brute-forcing email addresses to see who is registered)
     $email = Input::get('email');
     $password = Input::get('password');
     $user = User::where('email', $email)->first();
     if (!isset($user)) {
         return Response::json($this->growlMessage('That email does not exist.', 'error'), 400);
     }
     if (empty($user->token)) {
         return Response::json($this->growlMessage('That user was already confirmed.', 'error'), 400);
     }
     if (!Hash::check($password, $user->password)) {
         return Response::json($this->growlMessage('The password for that email is incorrect.', 'error'), 400);
     }
     $token = $user->token;
     $email = $user->email;
     $fname = $user->fname;
     //Send email to user for email account verification
     Mail::queue('email.signup', array('token' => $token), function ($message) use($email, $fname) {
         $message->subject('Welcome to the Madison Community');
         $message->from('sayhello@opengovfoundation.org', 'Madison');
         $message->to($email);
     });
     return Response::json($this->growlMessage('An email has been sent to your email address.  Please follow the instructions in the email to confirm your email address before logging in.', 'warning'));
 }
开发者ID:ritvikgautam,项目名称:madison,代码行数:32,代码来源:RemindersController.php

示例11: postSeen

 public function postSeen($docId, $commentId)
 {
     $allowed = false;
     $user = Auth::user();
     $user->load('docs');
     // Check user documents against current document
     foreach ($user->docs as $doc) {
         if ($doc->id == $docId) {
             $allowed = true;
             break;
         }
     }
     if (!$allowed) {
         throw new Exception("You are not authorized to mark this annotation as seen.");
     }
     $comment = Comment::find($commentId);
     $comment->seen = 1;
     $comment->save();
     $doc = Doc::find($docId);
     $vars = array('sponsor' => $user->fname . ' ' . $user->lname, 'label' => 'comment', 'slug' => $doc->slug, 'title' => $doc->title, 'text' => $comment->text);
     $email = $comment->user->email;
     Mail::queue('email.read', $vars, function ($message) use($email) {
         $message->subject('Your feedback on Madison was viewed by a sponsor!');
         $message->from('sayhello@opengovfoundation.org', 'Madison');
         $message->to($email);
         // Recipient address
     });
     return Response::json($comment);
 }
开发者ID:ritvikgautam,项目名称:madison,代码行数:29,代码来源:CommentApiController.php

示例12: sendTo

 public function sendTo($email, $subject, $view, $data = array())
 {
     //        Mail::pretend();
     Mail::queue($view, $data, function ($message) use($email, $subject) {
         $message->to($email)->subject($subject);
     });
 }
开发者ID:Gouken,项目名称:WebMuApp,代码行数:7,代码来源:UserMailer.php

示例13: sendEmployeeEmail

 /**
  * @param string $email
  * @param \Illuminate\Support\Collection $meetings
  */
 private static function sendEmployeeEmail($email, $meetings)
 {
     \Mail::queue('emails.optimise.ok.employee', ['meetings' => $meetings], function ($message) use($email) {
         $message->from(config('mail.from.address'), config('mail.from.name'));
         $message->to($email)->subject('Meetings of next week');
     });
 }
开发者ID:dsd-meetme,项目名称:backend,代码行数:11,代码来源:OkListener.php

示例14: sendTo

 /**
  * @param $user
  * @param $subject
  * @param $view
  * @param $data
  */
 public function sendTo($user, $subject, $view, $data = [])
 {
     \Mail::queue($view, $data, function ($message) use($user, $subject) {
         $message->from(\Config::get('site.mail_from'), \Config::get('site.name'));
         $message->to($user->email, $user->full_name)->subject($subject);
     });
 }
开发者ID:kcsamita,项目名称:laravelsnippets,代码行数:13,代码来源:Mailer.php

示例15: store

 /**
  * Store a newly created employee in storage.
  *
  * @return Response
  */
 public function store()
 {
     $data = Input::all();
     $validator = Validator::make($data, array('password' => 'min:6', 'email' => 'unique:employees', 'status' => 'required', 'role' => 'required'));
     if ($validator->fails()) {
         return Redirect::back()->withErrors($validator)->withInput();
     }
     $employee = new Employee();
     $employee->name = Input::get('name');
     $employee->save();
     $employee->password = Hash::make(Input::get('password'));
     $employee->save();
     $employee->email = Input::get('email');
     $employee->save();
     $employee->gender = Input::get('gender');
     $employee->save();
     $employee->age = Input::get('age');
     $employee->save();
     $employee->city = Input::get('city');
     $employee->save();
     $employee->country = Input::get('country');
     $employee->save();
     $employee->address = Input::get('address');
     $employee->save();
     if (Input::get('phone') == '') {
         $employee->phone = 'N/A';
     } else {
         $employee->phone = Input::get('phone');
     }
     $employee->save();
     if (Input::get('cnic') == '') {
         $employee->cnic = 'N/A';
     } else {
         $employee->cnic = Input::get('cnic');
     }
     $employee->save();
     if (Input::get('branch') == '') {
         $employee->branch = 'N/A';
     } else {
         $employee->branch = Input::get('branch');
     }
     $employee->save();
     if (Input::get('note') == '') {
         $employee->note = 'N/A';
     } else {
         $employee->note = Input::get('note');
     }
     $employee->save();
     $employee->status = Input::get('status');
     $employee->save();
     $employee->role = Input::get('role');
     $employee->save();
     $data = ['link' => URL::to('login'), 'name' => Input::get('name')];
     //      Send email to employee
     Mail::queue('emails.welcome', $data, function ($message) {
         $message->to(Input::get('email'), Input::get('name'))->subject('Welcome to EMR!');
     });
     return Redirect::route('employees.index');
 }
开发者ID:saqibtalib,项目名称:EMR-ex-,代码行数:64,代码来源:EmployeesController.php


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