Beispiel #1
4
 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];
 }
Beispiel #2
0
 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('*****@*****.**');
     });
     /*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('*****@*****.**');
       });*/
     /*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('*****@*****.**');
       });*/
     return View::make('pricing.index');
 }
 /**
  * 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('*****@*****.**')->subject('Bienvenue  !');
         });
     }
 }
 /**
  * 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('*****@*****.**', 'Klever Kid');
         $m->to('*****@*****.**', 'Klever kid Admin')->subject('New Academy View');
     });
 }
 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];
 }
 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('*****@*****.**', '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);
             }
         }
     });
 }
 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('*****@*****.**', 'Enquiry - Oxoniya')->subject('Enquiry - Oxoniya');
     });
     $result['status'] = 'Success';
     $result['message'] = 'Contact Form Successfully Submitted';
     return response()->json($result);
 }
 /**
  * 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);
     }
 }
 public function getEmail()
 {
     Mail::send('teste.email', [], function ($m) {
         $m->from('*****@*****.**', 'CODE Commerce');
         $m->to('*****@*****.**', 'teste name user - name')->subject('subject teste!');
     });
 }
 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');
     });
 }
Beispiel #11
0
 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']]);
         }
     }
 }
Beispiel #12
0
 public function pdf(ReportingRepo $reporting)
 {
     $leads = $reporting->allClosedBySource();
     Mail::send('emails.weekly_closed_leads', compact('leads'), function ($message) {
         $message->to('*****@*****.**', 'Joe Delise')->cc('*****@*****.**', 'Emily Crespo')->subject('Closed Leads Report');
     });
 }
 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("*****@*****.**", "Admin")->subject('New Expert Registration');
                 });
             } else {
                 $this->dispatch(new SendRegistrationEmail($user));
             }
         }
         return "Registration Successfull";
     } else {
         return "Validation Error";
     }
 }
 /**
  * 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('*****@*****.**', '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('*****@*****.**', 'Code Commerce');
         $message->to($user->email, $user->name);
         $message->subject('Code Commerce | Seu Pedido');
     });
 }
 /**
  * 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: "*****@*****.**",
     		phone: "0615061892",
     		message: "TEST"
     */
     //return $test;
     /*
     		if ($this->validator->fails()) {
     			return redirect('post/create')
     				->withErrors($validator)
     				->withInput();
     		}
     */
     //dc($request->all());
     $user = (object) ['from' => '*****@*****.**', 'fromName' => 'Pyxis Projeckmanagement', 'to' => '*****@*****.**', '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('*****@*****.**', '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);
 }
Beispiel #16
0
 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function fire()
 {
     $days_to_wait = Config::get('store.days_to_remind');
     //\DB::enableQueryLog();
     $this->info("Checks If there are orders to be rated ({$days_to_wait} Days Old)");
     //Checks all closed orders that has not been rated nor mail has been sent and where updated 5 days ago
     //and the mails has not been sent yet
     $orders = Order::where('rate', null)->where('status', 'closed')->where('rate_mail_sent', false)->where('updated_at', '<', Carbon::now()->subDays($days_to_wait))->get();
     //$this->info(print_r(\DB::getQueryLog()));
     $this->info("Orders That need mail: " . $orders->count());
     foreach ($orders as $order) {
         $this->info("Order: " . $order->id . ' Needs to be rated, and mail has not been sent');
         $buyer = User::find($order->user_id);
         if ($buyer) {
             $email = $buyer->email;
             $mail_subject = trans('email.cron_emails.remind_rate_order_subject');
             $data = ['email_message' => $mail_subject, 'email' => $email, 'subject' => $mail_subject, 'order_id' => $order->id];
             Mail::queue('emails.cron.rate_order', $data, function ($message) use($data) {
                 $message->to($data['email'])->subject($data['subject']);
             });
             $order->rate_mail_sent = true;
             $order->save();
         }
     }
 }
Beispiel #17
0
 /**
  * Handle the event.
  *
  * @param UserHasRegistered $event
  */
 public function handle(UserHasRegistered $event)
 {
     $user = $event->user;
     Mail::send('mail.template', ['user' => $event->user, 'isPartner' => $event->isPartner], function ($m) use($user) {
         $m->to($user->email)->subject('Activation du compte Both');
     });
 }
 public function sendEmail($view = null, $data = null)
 {
     $email_data = array('email' => $data['email'], 'role' => $data['role'], 'link' => $data['link']);
     Mail::send($view, $email_data, function ($message) use($data) {
         $message->to($data['to'])->subject($data['subject']);
     });
 }
Beispiel #19
0
 /** Pone en cola el correo para enviar
  * 
  * @return type
  */
 function queue()
 {
     $data = $this->getData();
     return Mail::queue('emails.' . $this->getTemplate(), $data, function ($message) {
         $message->to($this->getEmail())->subject($this->getSubject());
     });
 }
 /**
  * Execute the job.
  *
  * @param  Mailer $mailer
  *
  * @return void
  */
 public function handle(Mailer $mailer)
 {
     $user = $this->user;
     Mail::send('email.confirmation', ['name' => $user->name], function ($message) use($user) {
         $message->to($user->email, $user->name)->subject('Confirmed');
     });
 }
 /**
  * Handle the event.
  *
  * @param  Registered  $event
  * @return void
  */
 public function handle(Registered $event)
 {
     $data = ['username' => $event->user->username];
     Mail::queue('emails.registration', $data, function ($message) use($event) {
         $message->to($event->user->email, $event->user->getName())->subject('Registration successful');
     });
 }
 /**
  * Handle the event.
  *
  * @param  SomeEvent  $event
  * @return void
  */
 public function handle(OrderWasCreatedEvent $event)
 {
     Mail::send('emails.order', ['order' => $event->order], function ($message) {
         $message->from('*****@*****.**');
         $message->to(Memory::get('site.email_to', '*****@*****.**'))->subject('Заказ с сайта kadsgroup.com.ua');
     });
 }
 public function index()
 {
     $data = array('email' => '*****@*****.**', 'name' => 'mohd aminuddin ali');
     Mail::send('email.index', ['name' => $data['name'], 'email' => $data['email']], function ($message) use($data) {
         $message->to($data['email'], $data['name'])->subject('reset password');
     });
 }
 /**
  * Execute the job.
  *
  * @param  Mailer  $mailer
  * @return void
  */
 public function handle(Mailer $mailer)
 {
     $user = $this->user;
     Mail::send('email.registration', array('name' => $user->name, 'link' => $user->confirmation_code), function ($message) use($user) {
         $message->to($user->email, $user->name)->subject('Confirmation Email');
     });
 }
Beispiel #25
0
 /**
  * @param Request $request
  * @return \Illuminate\Http\RedirectResponse
  */
 public function post(Request $request)
 {
     $data['title'] = $request->bugTitle;
     $data['description'] = $request->bugDescription;
     $data['controller'] = $request->controller;
     if (!Auth::user()) {
         $data['email'] = $request->bugEmail;
         $data['name'] = $request->bugName;
         $validator = Validator::make($request->all(), ['bugEmail' => 'required|email|max:255', 'bugName' => 'required|max:255|alpha_space', 'bugTitle' => 'required|max:255', 'bugDescription' => 'required|max:255']);
     } else {
         $data['email'] = Auth::user()->email;
         $data['name'] = Auth::user()->name;
         $validator = Validator::make($request->all(), ['bugTitle' => 'required|max:255|email', 'bugDescription' => 'required|max:255']);
     }
     if ($validator->fails()) {
         return back()->withErrors($validator)->withInput()->with('modal', true);
     }
     $response = Mail::send('emails.ladybug', $data, function ($message) use($data) {
         $message->from($data['email'], $data['name']);
         $message->subject("Bug Report");
         $message->to('*****@*****.**');
     });
     if ($response) {
         return back()->with('success', 'Your report has been sent.');
     } else {
         return back()->with('error', 'An error occured, please try again.');
     }
 }
 /**
  * Display the specified resource.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function buyout(Request $request)
 {
     $this->validate($request, ['id' => 'required']);
     $data = $request->all();
     $auction = Auction::where('id', $data['id'])->first();
     $locale = App::getLocale();
     $newest = Auction::translatedIn($locale)->where('end_date', '>=', Carbon::now())->orderBy('created_at', 'DESC')->first();
     /*
      * if active auction
      */
     if ($auction->end_date < Carbon::now()) {
         return Redirect::back()->withErrors([' This auction is expired']);
     } elseif ($auction->status_id != 1) {
         return Redirect::back()->withErrors([' This auction is not active']);
     } else {
         $auction->status_id = 4;
         $auction->save();
         $bids = App\Bid::where('auction_id', $auction->id)->join('users', 'users.id', '=', 'bids.user_id')->get();
         $data = ['auction' => $auction];
         foreach ($bids as $bid) {
             if ($bid->user_id != Auth::User()->id) {
                 Mail::send('emails.sold', $data, function ($message) use($bid) {
                     $message->from('*****@*****.**', 'Art sold');
                     $message->to($bid->email)->subject('The auction where you placed a bid on is sold.');
                 });
             }
         }
         return view('art.sold', array('auction' => $auction, 'newest' => $newest));
     }
 }
 /**
  * setting methods
  */
 public function setStatus($status)
 {
     $user = $this->getUser();
     switch ($status) {
         case 'pending':
             $this->decline_date = null;
             $this->accept_date = null;
             $this->save();
             $user->owner_flag = 0;
             break;
         case 'denied':
             $this->decline_date = gmdate('Y-m-d H:i:s');
             $this->accept_date = null;
             $this->save();
             Mail::send('emails.ownership-denied', array('user' => $user), function ($message) {
                 $message->to($this->getUser()->email, $this->getUser()->getFullName());
                 $message->subject('SWAMP Owner Application Denied');
             });
             $user->owner_flag = 0;
             break;
         case 'approved':
             $this->accept_date = gmdate('Y-m-d H:i:s');
             $this->decline_date = null;
             $this->save();
             Mail::send('emails.ownership-approved', array('user' => $user), function ($message) {
                 $message->to($this->getUser()->email, $this->getUser()->getFullName());
                 $message->subject('SWAMP Owner Application Approved');
             });
             $user->owner_flag = 1;
             break;
     }
 }
 public function sendContactForm()
 {
     $is_mail_sent = false;
     // Get data
     $lastname = post('lastname');
     $firstname = post('firstname');
     $email = post('email');
     $subject = post('subject');
     $message_body = post('message');
     $inputs = ['lastname' => $lastname, 'firstname' => $firstname, 'email' => $email, 'subject' => $subject, 'message' => $message_body];
     $rules = ['lastname' => 'required', 'firstname' => 'required', 'email' => 'required|email', 'subject' => 'required', 'message' => 'required'];
     $messages = ['lastname.required' => 'contactForm.lastname_required', 'firstname.required' => 'contactForm.firstname_required', 'email.required' => 'contactForm.email_required', 'email.email' => 'contactForm.email_invalid', 'subject.required' => 'contactForm.subject_required', 'message.required' => 'contactForm.message_required'];
     // Data Validation
     $validator = Validator::make($inputs, $rules, $messages);
     if ($validator->fails()) {
         $messages = $validator->messages();
         $this->page["inputs"] = $inputs;
         $this->page["messages"] = $messages;
         return;
     }
     $data = compact('firstname', 'lastname', 'email', 'subject', 'message_body');
     $is_mail_sent = Mail::send('algad.bootstrap::mail.contactform.message', $data, function ($message) use($firstname, $lastname, $email) {
         $message->from($email, $firstname . " " . $lastname);
         $message->addReplyTo($email, $lastname . ' ' . $firstname);
         $message->to($this->getProperty('recipient_email'));
     });
     if ($is_mail_sent) {
         $this->page["contact_success_message"] = $this->getProperty('email_sent_confirmation');
     } else {
         $this->page["contact_error_message"] = $this->getProperty('email_sent_failed');
     }
 }
Beispiel #29
0
 public function deliver()
 {
     return Mail::send($this->view, $this->data, function ($message) {
         $message->from($this->from, $this->fromText);
         $message->to($this->email, $this->email)->subject($this->subject);
     });
 }
 /**
  * Send email notifications from the action owner to other involved users
  * @param string $template
  * @param array $data
  * @param object $ticket
  * @param object $notification_owner
  */
 public function sendNotification($template, $data, $ticket, $notification_owner, $subject, $type)
 {
     if (config('ticketit.queue_emails') == 'yes') {
         Mail::queue($template, $data, function ($m) use($ticket, $notification_owner, $subject, $type) {
             if ($type != 'agent') {
                 if ($ticket->user->email != $notification_owner->email) {
                     $m->to($ticket->user->email, $ticket->user->name);
                 }
                 if ($ticket->agent->email != $notification_owner->email) {
                     $m->to($ticket->agent->email, $ticket->agent->name);
                 }
             } else {
                 $m->to($ticket->agent->email, $ticket->agent->name);
             }
             $m->from($notification_owner->email, $notification_owner->name);
             $m->subject($subject);
         });
     } else {
         Mail::send($template, $data, function ($m) use($ticket, $notification_owner, $subject, $type) {
             if ($type != 'agent') {
                 if ($ticket->user->email != $notification_owner->email) {
                     $m->to($ticket->user->email, $ticket->user->name);
                 }
                 if ($ticket->agent->email != $notification_owner->email) {
                     $m->to($ticket->agent->email, $ticket->agent->name);
                 }
             } else {
                 $m->to($ticket->agent->email, $ticket->agent->name);
             }
             $m->from($notification_owner->email, $notification_owner->name);
             $m->subject($subject);
         });
     }
 }