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


PHP Facades\Mail类代码示例

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


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

示例1: 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

示例2: sendquotation

 public function sendquotation()
 {
     $input = Input::all();
     $name = $input['name'];
     $email_client = $input['email'];
     $phone_client = $input['phone'];
     $title = $input['title'];
     $msg_webneoo = nl2br($input['msg_webneoo']);
     Mail::send('emails.quotation', ['name' => $name, 'email_client' => $email_client, 'phone_client' => $phone_client, 'msg_webneoo' => $msg_webneoo], function ($m) use($email_client, $title) {
         $m->from($email_client, 'Webneoo')->subject($title);
         $m->to('info@webneoo.com');
     });
     /*Mail::send('emails.contact', array('name' => $name, 'email_client' => $email_client, 'subject_client' => $subject_client, 'msg_webneoo' => $msg_webneoo), function($message) use ($email_client)
       {
           $message->from($email_client, 'Webneoo')->subject('From Webneoo Website');
           $message->to('info@webneoo.com');
       });*/
     /*Mail::send('emails.quotation', array('name' => $name, 'email_client' => $email_client, 
       									'subject_client' => $subject_client, 'msg_webneoo' => $msg_webneoo), 
       										function($message) use ($email_client, $title)
       {
           $message->from($email_client, 'Webneoo')->subject($title);
           $message->to('info@webneoo.com');
       });*/
     return View::make('pricing.index');
 }
开发者ID:Webneoo,项目名称:webneoo,代码行数:26,代码来源:ContactController.php

示例3: __construct

 /**
  * Create a new event instance.
  *
  * @return void
  */
 public function __construct($EcNa, $typ, $eml, $pass, $nomresp, $fix, $port, $adres, $ville, $pays)
 {
     $this->ecoleNom = $EcNa;
     $this->type = $typ;
     $this->email = $eml;
     $this->password = $pass;
     $this->nomResponsable = $nomresp;
     $this->fix = $fix;
     $this->portab = $port;
     $this->adresse = $adres;
     $this->ville = $ville;
     $this->pays = $pays;
     $user = new User();
     $user->name = $this->ecoleNom;
     $user->type = $this->type;
     $user->email = $this->email;
     $user->password = \Hash::make($this->password);
     $user->nom_responsable = $this->nomResponsable;
     $user->tel_fixe = $this->fix;
     $user->tel_portable = $this->portab;
     $user->adresse = $this->adresse;
     $user->ville = $this->ville;
     $user->pays = $this->pays;
     $user->save();
     if ($user) {
         $info = ['nom_resp' => $this->nomResponsable, 'nom_ecole' => $this->ecoleNom, 'email' => $this->email, 'pass' => $this->password];
         Mail::queue('emails.school', $info, function ($message) {
             $message->to($this->email, 'ok')->from('creche@gmail.com')->subject('Bienvenue  !');
         });
     }
 }
开发者ID:khaleader,项目名称:creche,代码行数:36,代码来源:SchoolSendEmailEvent.php

示例4: handle

 /**
  * Handle the event.
  *
  * @param  AcademyViewed  $event
  * @return void
  */
 public function handle(AcademyViewed $event)
 {
     Mail::queue('emails.academyviewed', ['academy' => $event->academy, 'ip' => $event->ip], function ($m) {
         $m->from('views@kleverkid.com', 'Klever Kid');
         $m->to('pankajkleverkid@gmail.com', 'Klever kid Admin')->subject('New Academy View');
     });
 }
开发者ID:pankajadhyapak,项目名称:KleverKid-assignement,代码行数:13,代码来源:SendAcademyViewedMail.php

示例5: getCreate

 public function getCreate(Request $request)
 {
     header("Access-Control-Allow-Origin: *");
     header("Allow: GET, POST, OPTIONS");
     $error = false;
     $msg = "";
     try {
         $nombre = $request->input('nombre');
         $dni = $request->input('dni');
         $email = $request->input('email');
         $password = $request->input('password');
         $telefono = $request->input('telefono');
         $dominio = $request->input('dominio');
         if (User::whereRaw('email=?', [$email])->count() > 0) {
             $user = null;
             $error = true;
             $msg = "Este correo ya ha sido registrado";
         } else {
             $user = User::create(['name' => $nombre, "dni" => $dni, 'email' => $email, "password" => $password, "telefono" => $telefono]);
             $user->codigo = $user->id . date("i") . date("d");
             $user->save();
             $data = array('url' => $dominio . "/confirmar?mail=" . $user->email . "&confirmar=" . $user->codigo);
             Mail::send('mails.confirmacion', $data, function ($message) use($user) {
                 $message->to($user->email)->subject('Confirmar registro');
             });
             $msg = "Se envio un correo de confirmmacion a su cuenta de correo";
         }
     } catch (\Exception $e) {
         $user = null;
         $error = true;
         $msg = $e->getMessage();
     }
     return ["user" => $user, "error" => $error, "msg" => $msg];
 }
开发者ID:Truexxangusxx,项目名称:Servicio_laravel,代码行数:34,代码来源:UsersController.php

示例6: sendMessage

 public function sendMessage(VolunteerPositionRequest $request)
 {
     $data = $request->all();
     $data['campus'] = Campus::find($data['campus'])->name;
     $data['sent_at'] = Carbon::now()->format('D, M j, Y at g:i A');
     $data['phone'] = preg_replace('~.*(\\d{3})[^\\d]{0,7}(\\d{3})[^\\d]{0,7}(\\d{4}).*~', '($1) $2-$3', $data['phone']);
     $to = null;
     $cc = [];
     // Hidden field probably means spam
     if (isset($data['flytrap'])) {
         $data['subject'] = 'SPAM? --' . $data['subject'];
         $to = Staff::findBySlug('brad-roberts');
     } else {
         $to = Staff::findBySlug('miles-creasman');
         $cc[] = Staff::findBySlug('penny-spivey');
         $cc[] = Staff::findBySlug('brad-roberts');
     }
     Mail::queue('emails.volunteer_request', $data, function ($message) use($data, $to, $cc) {
         $full_name = $data['first_name'] . ' ' . $data['last_name'];
         $subject = 'Ministry Volunteer' . (empty($data['subject']) ? '' : ' - ' . $data['subject']);
         $message->from('noreply@faithpromise.org', 'Faith Promise Website')->replyTo($data['email'], $full_name)->subject($subject)->to($to->email, $to->name);
         if (count($cc) > 0) {
             foreach ($cc as $recipient) {
                 $message->cc($recipient->email, $recipient->name);
             }
         }
     });
 }
开发者ID:mcculley1108,项目名称:faithpromise.org,代码行数:28,代码来源:VolunteerController.php

示例7: sendEnquireMail

 public function sendEnquireMail()
 {
     $name = Input::get('name');
     $email = Input::get('email');
     $mobile = Input::get('mobile');
     $message2 = Input::get('message');
     $result = array();
     $validation = $validator = Validator::make(array('Name' => $name, 'email' => $email, 'Mobile' => $mobile, 'Message' => $message2), array('Name' => 'required', 'email' => 'required|email', 'Mobile' => 'required|numeric', 'Message' => 'required'));
     if ($validation->fails()) {
         $result['status'] = 'Failure';
         $result['message'] = 'Fill all fields with valid values';
         return response()->json($result);
     }
     $data['name'] = $name;
     $data['email'] = $email;
     $data['mobile'] = $mobile;
     $data['message2'] = $message2;
     Mail::send('mail.enquire', $data, function ($message1) use($data) {
         $message1->from($data['email'], $data['name']);
         $message1->to('info@oxoniyabuilders.com', 'Enquiry - Oxoniya')->subject('Enquiry - Oxoniya');
     });
     $result['status'] = 'Success';
     $result['message'] = 'Contact Form Successfully Submitted';
     return response()->json($result);
 }
开发者ID:shayasmk,项目名称:travellocal,代码行数:25,代码来源:MailController.php

示例8: sendEmail

 /**
  * sendEmail  : Sends received email to target
  *
  * @return array : asociative array with the final status of request
  */
 public function sendEmail()
 {
     // Recovers mail data object
     $mailData = json_decode(Input::get('emailData'));
     //Defines validator object
     $validator = Validator::make((array) $mailData, ['email' => array('required', 'regex:/^((<[a-z]+>)?[\\.a-zA-ZáéíóúÁÉÍÓÚñÑ_1-9]+@[a-zA-ZáéíóúÁÉÍÓÚñÑ_-]+\\.[a-zA-ZáéíóúÁÉÍÓÚñÑ]{2,12})(,((<[a-z]+>)?[\\.a-zA-ZáéíóúÁÉÍÓÚñÑ_1-9]+@[a-zA-ZáéíóúÁÉÍÓÚñÑ_-]+\\.[a-zA-ZáéíóúÁÉÍÓÚñÑ]{2,12}))*$/'), 'subject' => array('required', 'regex:/^[a-zA-ZáéíóúÁÉÍÓÚñÑ1-9][a-zA-ZáéíóúÁÉÍÓÚñÑ1-9 ]{3,50}$/')]);
     // Returns fail message if validation fails
     if ($validator->fails()) {
         return response()->json(['status' => 'fail'], 200);
     } else {
         // Split string of emails into an array of emails
         $allMails = explode(',', $mailData->email);
         // For each mail in $allMails, actual name and target of each mail are getted, and then the email is sent
         foreach ($allMails as $mail) {
             $separatorPosition = strpos($mail, '>');
             if ($separatorPosition) {
                 $name = substr($mail, 1, $separatorPosition - 1);
                 $target = substr($mail, $separatorPosition + 1);
             } else {
                 $target = $mail;
                 $name = '';
             }
             Mail::send([], [], function ($message) use($mailData, $target, $name) {
                 $message->to($target, $name);
                 $message->subject($mailData->subject);
                 $message->setBody($mailData->htmlContent, 'text/html');
             });
         }
         return response()->json(['status' => 'success'], 200);
     }
 }
开发者ID:ezzing,项目名称:email-template-manager,代码行数:36,代码来源:MailController.php

示例9: getEmail

 public function getEmail()
 {
     Mail::send('teste.email', [], function ($m) {
         $m->from('houstonfernandes@gmail.com', 'CODE Commerce');
         $m->to('houstonfernandes@yahoo.com.br', 'teste name user - name')->subject('subject teste!');
     });
 }
开发者ID:houstonfernandes,项目名称:curso_laravel,代码行数:7,代码来源:TestController.php

示例10: send

 public function send($user)
 {
     $code = $user->getActivationCode();
     Mail::queue(array('laravel-sentry-backend::emails.activation_code_html', 'laravel-sentry-backend::emails.activation_code_txt'), compact('user', 'code'), function ($message) use($user) {
         $message->to($user->email)->subject('Your account activation code');
     });
 }
开发者ID:djordje,项目名称:laravel-sentry-backend,代码行数:7,代码来源:AccountActivation.php

示例11: write

 protected function write(array $record)
 {
     $hasLevel = in_array($record['level_name'], config('dblogger.levels'));
     $hasChannel = in_array($record['message'], config('dblogger.channels'));
     $notifications = config('dblogger.notification');
     $send_notification = 0;
     foreach ($notifications as $key => $value) {
         if ($key === $record['message']) {
             $send_notification = in_array($record['level_name'], $value);
         }
     }
     if ($send_notification) {
         $messages = config('dblogger.messages');
         $data = ['record' => $record, 'action' => isset($messages[$record['message']]) ? $messages[$record['message']] : $record['message']];
         Mail::send("dblogger::notification", $data, function ($message) {
             $message->to(config('dblogger.mail_to'))->subject(config('dblogger.mail_subject'));
         });
     }
     if ($hasLevel && $hasChannel) {
         if (config('dblogger.service') === 'remote') {
             $this->post_remote($record);
         } else {
             Logger::create(['message' => $record['message'], 'context' => json_encode($record['context']), 'level' => $record['level'], 'level_name' => $record['level_name']]);
         }
     }
 }
开发者ID:gazatem,项目名称:dblogger,代码行数:26,代码来源:DBLogger.php

示例12: pdf

 public function pdf(ReportingRepo $reporting)
 {
     $leads = $reporting->allClosedBySource();
     Mail::send('emails.weekly_closed_leads', compact('leads'), function ($message) {
         $message->to('jdelise@c21scheetz.com', 'Joe Delise')->cc('ecrespo@c21scheetz.com', 'Emily Crespo')->subject('Closed Leads Report');
     });
 }
开发者ID:jdelise,项目名称:career_site,代码行数:7,代码来源:TestController.php

示例13: register

 public function register()
 {
     $enabled_registrations = [2, 3];
     $confirmation_code = str_random(30);
     $data = ['name' => Input::get('name'), 'email' => Input::get('email'), 'password' => Input::get('password'), 'role_id' => Input::get('role_id'), User::MOBILE_NUMBER => Input::get('mobile_number', NULL), User::DESCRIPTION => Input::get('description', NULL), User::IMAGE => Input::get('image', NULL), User::BIRTH_DATE => Input::get('birth_date', NULL), User::GENDER => Input::get('gender', NULL), 'confirmation_code' => $confirmation_code];
     if (!in_array($data['role_id'], $enabled_registrations)) {
         return "Invalid role";
     }
     if ($this->validator($data)) {
         $data = array_filter($data, 'strlen');
         $user = User::create($data);
         $user->roles()->attach($data['role_id']);
         $role = Role::where('name', 'Expert')->select(['id'])->first();
         if (!is_null($role)) {
             $role_id = $role->id;
             if ($role_id == $data['role_id']) {
                 $user_extra = $this->insertExtra($user->id);
                 //to be implemented
                 // mail has to be sent to the admin all details of the newly signed up expert.
                 $data = ["first_name" => isset($user_extra->first_name) && $user_extra->first_name != NULL ? $user_extra->first_name : "not available", "last_name" => isset($user_extra->last_name) && $user_extra->last_name != NULL ? $user_extra->last_name : "not available", "personal_email" => isset($user_extra->personal_email) && $user_extra->personal_email != NULL ? $user_extra->personal_email : "not available", "highest_degree" => isset($user_extra->highest_degree) && $user_extra->highest_degree != NULL ? $user_extra->highest_degree : "not available", "major_specialization" => isset($user_extra->major_specialization) && $user_extra->major_specialization != NULL ? $user_extra->major_specialization : "not available", "profession" => isset($user_extra->profession) && $user_extra->profession != NULL ? $user_extra->profession : "not available", "expert_area" => isset($user_extra->expert_area) && $user_extra->expert_area != NULL ? $user_extra->expert_area : "not available", "linkedin_url" => isset($user_extra->linkedin_url) && $user_extra->linkedin_url != NULL ? $user_extra->linkedin_url : "not available", "research_gate_id" => isset($user_extra->research_gate_id) && $user_extra->research_gate_id != NULL ? $user_extra->research_gate_id : "not available", "facebook_url" => isset($user_extra->facebook_url) && $user_extra->facebook_url != NULL ? $user_extra->facebook_url : "not available", "resume_url" => isset($user_extra->resume_url) && $user_extra->resume_url != NULL ? $user_extra->resume_url : "not available", "email" => isset($user->email) && $user->email != NULL ? $user->email : "not available", "mobile_number" => isset($user->mobile_number) && $user->mobile_number != NULL ? $user->mobile_number : "not available", "description" => isset($user->description) && $user->description != NULL ? $user->description : "not available", "gender" => isset($user->gender) && $user->gender != NULL ? $user->gender : "not available", "birth_date" => isset($user->birth_date) && $user->birth_date != NULL ? $user->birth_date : "not available", "image" => isset($user->image) && $user->image != NULL ? $user->image : "not available"];
                 Mail::send('email.email_to_admin', $data, function ($message) {
                     $message->to("tamyworld@gmail.com", "Admin")->subject('New Expert Registration');
                 });
             } else {
                 $this->dispatch(new SendRegistrationEmail($user));
             }
         }
         return "Registration Successfull";
     } else {
         return "Validation Error";
     }
 }
开发者ID:Scaledesk,项目名称:gritwings,代码行数:32,代码来源:RegistrationController.php

示例14: handle

 /**
  * Handle the event.
  *
  * @param  CheckoutEvent  $event
  * @return void
  */
 public function handle(CheckoutEvent $event)
 {
     /*
     *  public function sendEmailReminder(Request $request, $id)
         {
             $user = User::findOrFail($id);
     
             Mail::send('emails.reminder', ['user' => $user], function ($m) use ($user) {
        $m->from('hello@app.com', 'Your Application');
     
        $m->to($user->email, [=´çpoktfçfgnf '$user->name)->subject('Your Reminder!');
             });
         }kkkkmolpkiolo.;
     
     
     
     
     [
     */
     $user = $event->getUser();
     $order = $event->getOrder();
     Mail::send('emails.checkout', compact('user', 'order'), function ($message) use($order, $user) {
         $message->from('pedido@codecommerce.com', 'Code Commerce');
         $message->to($user->email, $user->name);
         $message->subject('Code Commerce | Seu Pedido');
     });
 }
开发者ID:sandrosales,项目名称:laravel_commerce-Checkout03,代码行数:33,代码来源:SendEmailCheckout.php

示例15: sendEmailContact

 /**
  * Send an e-mail reminder to the user.
  *
  * @param  Request  $request
  * @param  int  $id
  * @return Response
  */
 public function sendEmailContact(Request $request)
 {
     //return response()->json($request->all());
     $test = $this->validate($request, ['name' => 'required|max:255', 'email' => 'required|email', 'phone' => 'required|digits:10', 'message' => 'required']);
     /*
     		_token: "b0cehzEEK2fbzXilKcI9CiijhEClyBIXkvTpPCze",
     		name: "Tonny Wijnand",
     		email: "tonnywijnand@gmail.com",
     		phone: "0615061892",
     		message: "TEST"
     */
     //return $test;
     /*
     		if ($this->validator->fails()) {
     			return redirect('post/create')
     				->withErrors($validator)
     				->withInput();
     		}
     */
     //dc($request->all());
     $user = (object) ['from' => 'info@pyxis-projekten.nl', 'fromName' => 'Pyxis Projeckmanagement', 'to' => 'tonnywijnand@gmail.com', 'toName' => 'Tonny Wijnand', 'subject' => 'Contact formulier via website pyxis'];
     $test = Mail::send(['emails.contact-form', 'emails.contact-form-text'], ['user' => $user], function ($m) use($user) {
         //$m->from('hello@app.com', 'Your Application');
         //$m->to($user->email, $user->name)->subject('Your Reminder!');
         $m->from($user->from, $user->fromName);
         $m->to($user->to, $user->toName)->subject($user->subject);
     });
     $data = ['status' => 'success', 'statusText' => 'Update is gelukt', 'responseText' => 'De volgorde is aangepast', 'mail' => $test];
     return response()->json($data);
 }
开发者ID:wi-development,项目名称:my-framework,代码行数:37,代码来源:SitemapController.php


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