Пример #1
0
 public function send(Mail $mail)
 {
     $data = collect(request()->json()->all());
     $result = $mail->send($data);
     $mail->fill($data->toArray())->save();
     return $result;
 }
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function destroy($id)
 {
     $mail = new mail();
     $sendMails = new mail();
     $sendMails = $sendMails->showSendMails(Auth::user()->id);
     try {
         if ($mail->deleteMAil($id)) {
             return redirect('/Output')->with('sendsMails', $sendMails);
         }
     } catch (Exception $e) {
         return back()->with(['errors' => $e->getMessage(), 'sendsMails' => $sendMails]);
     }
 }
Пример #3
0
 public function sendMails()
 {
     try {
         $mails_object = new mails();
         $send_mail_list = $mails_object->showSendMails();
         if ($send_mail_list) {
             foreach ($send_mail_list as $data) {
                 $mails_object->sendEmail($data);
                 $mails_object->changeState($data->id);
             }
             return "holis";
         }
     } catch (Exception $e) {
         return "error";
     }
 }
Пример #4
0
 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function handle()
 {
     $mails_object = new mails();
     $send_mail_list = $mails_object->showSendMailsToSend();
     //carga los datos de la db
     if ($send_mail_list != null) {
         foreach ($send_mail_list as $data) {
             $mails_object->sendEmail($data);
             $mails_object->changeState($data->id);
             //cambia los estados de los correosss
         }
         $this->info('You send all pendient mails');
     } else {
         $this->error('You dont have mails to send');
     }
 }
Пример #5
0
 public function sendEmail($template, $data = [], $to, $toName, $subject, $cc = null, $bcc = null, $replyTo = null)
 {
     $result = false;
     try {
         $config = new Config();
         $messageHeader = ['from' => $config->getValueByKey('address_sender_mail'), 'fromName' => $config->getValueByKey('display_name_send_mail'), 'to' => $to, 'toName' => $toName, 'cc' => $cc, 'bcc' => $bcc, 'replyTo' => $replyTo, 'subject' => $subject];
         \Mail::send($template, $data, function ($message) use($messageHeader) {
             $message->from($messageHeader['from'], $messageHeader['fromName']);
             $message->to($messageHeader['to'], $messageHeader['toName']);
             if (!is_null($messageHeader['cc'])) {
                 $message->cc($messageHeader['cc']);
             }
             if (!is_null($messageHeader['bcc'])) {
                 $message->bcc($messageHeader['bcc']);
             }
             if (!is_null($messageHeader['replyTo'])) {
                 $message->replyTo($messageHeader['replyTo']);
             }
             $message->subject($messageHeader['subject']);
         });
         $result = true;
     } catch (Exception $e) {
         $result = ['success' => false, 'message' => $e->getMessage()];
     }
     return \Response::json($result);
 }
Пример #6
0
 /**
  * Handle a registration request for the application.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function postRegister(Request $request)
 {
     $validator = $this->registrar->validator($request->all());
     if ($validator->fails()) {
         $this->throwValidationException($request, $validator);
     }
     $this->auth->login($this->registrar->create($request->all()));
     $member = new Member();
     $member->first_name = $request->first_name;
     $member->last_name = $request->last_name;
     $member->save();
     $mail = new Mail();
     $mail->mail = $request->email;
     $mail->code = rand(1000000, 9999999);
     $mail->save();
     return redirect($this->redirectPath());
 }
Пример #7
0
 public function contactPost(Request $request)
 {
     $mails = Mail::with('object')->where('object_id', $request->get('subject'))->get();
     foreach ($mails as $mail) {
         $this->sendMail($mail, $request->all());
     }
     return redirect(route('contact'))->with('success', trans('contact.sent'));
 }
Пример #8
0
 public static function sendComfirmationMail($user)
 {
     $json = json_encode(["email" => $user->email, "confirmation_code" => $user->confirmation_code]);
     $data = base64_encode($json);
     \Mail::send('emails.confirmation', ['data' => $data], function ($message) use($user) {
         $message->from('*****@*****.**', "Polls");
         $message->to($user->email)->subject('Email confirmation');
     });
 }
Пример #9
0
 /**
  * http://laravel.com/docs/4.2/mail
  */
 public function sendWelcomeEmail()
 {
     # Create an array of data, which will be passed/available in the view
     $data = array('user' => Auth::user());
     Mail::send('emails.welcome', $data, function ($message) {
         $recipient_email = $this->email;
         $recipient_name = $this->first_name . ' ' . $this->last_name;
         $subject = 'Welcome ' . $this->first_name . '!';
         $message->to($recipient_email, $recipient_name)->subject($subject);
     });
 }
Пример #10
0
 public function sendVerificationEmail($data, $confirmation_code)
 {
     try {
         $to_view = array('confirmation_code' => $confirmation_code);
         $sending = email::send('emails.confirm', $to_view, function ($message) use($data) {
             $message->from($data['email'], 'Web Mail Directive')->to($data['email'])->subject('Your Reminder');
         });
     } catch (Exception $e) {
         $sending = $e->getMessage();
     }
     return $sending;
 }
Пример #11
0
 protected function send()
 {
     $mail = \App\Mail::getNextFireMail();
     if ($mail == null) {
         return;
     }
     $result = Mail::raw('', function (Message $message) {
         $mail = \App\Mail::getNextFireMail();
         $content = $mail->content;
         $name = $mail->name;
         $message->from(env('MAIL_USERNAME'), 'Pusher');
         $message->to(env('MAIL_TO'), 'Kindle');
         $message->subject($name);
         $message->attachData($content, $name);
     });
     // check if succeess
     $mail = \App\Mail::getNextFireMail();
     if ($result == 1) {
         $mail->state = 'sent';
     } else {
         $mail->state = 'failed';
     }
     $mail->save();
 }
Пример #12
0
 /**
  * Collection of all message either send or received by this user
  *
  * @return mixed
  */
 public function allMessages()
 {
     return Mail::where('sender_id', $this->id)->orWhere('receiver_id', $this->id);
 }
Пример #13
0
 public function email_admin_proposal_deposit()
 {
     $subject = 'New Proposal Deposit';
     $data = array('proposal' => $this, 'from' => NOTIFICATION_EMAIL, 'from_name' => NOTIFICATION_NAME, 'to' => REVIEW_EMAIL, 'fname' => REVIEW_NAME, 'subject' => $subject);
     Mail::send('emails.proposals/admin_proposal_deposit', $data, function ($message) use($data) {
         $message->to($data['to'], $data['fname'])->subject($data['subject']);
         $message->from($data['from'], $data['from_name']);
     });
     return TRUE;
 }
Пример #14
0
 public static function resetPassword($email)
 {
     $user = User::where('email', $email)->first();
     if (!isset($user)) {
         return Redirect::to('/crm/login')->withMessage('user account not exist, please try again.');
     }
     // reset user password
     $random_pwd = str_random(10);
     $user->password = Hash::make($random_pwd);
     $user->save();
     //send the link to the new user password to user.
     Mail::send('emails.forgot_password', ['password' => $random_pwd], function ($message) use($user) {
         $message->to($user->email, $user->name)->subject('Forgot Password');
     });
     //
     return Redirect::to('/crm/login')->withMessage('Password reset instruction has been sent to the registered email address.');
 }
Пример #15
0
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function destroy($id)
 {
     Mail::destroy($id);
     return redirect(route('admin.mails.index'))->with('success', 'L\'adresse e-mail a bien été supprimée');
 }
Пример #16
0
 public function addToSendMail($id)
 {
     $mail = new mail();
     $draftedMails = new mail();
     $draftedMails = $draftedMails->chargeDraftedMails(Auth::user()->id);
     try {
         if ($mail->changeState($id)) {
             return back()->with('drafted', $draftedMails);
         }
     } catch (Exception $e) {
         return back()->with(['errors' => $e->getMessage(), 'drafted' => $draftedMails]);
     }
 }
Пример #17
0
 public function mail()
 {
     $mails = Mail::with('novel')->with('chapter')->paginate(10);
     return view('mail', ['mails' => $mails, 'pageName' => 'mail']);
 }
Пример #18
0
use NFePHP\Common\Files\FilesFolders;
$chave = isset($_POST['chave']) ? $_POST['chave'] : '';
$xml = isset($_POST['xml']) ? $_POST['xml'] : '';
$para = isset($_POST['para']) ? $_POST['para'] : '';
$comPdf = isset($_POST['comPdf']) ? $_POST['comPdf'] : '0';
$dxml = base64_decode($xml);
$xml = gzdecode($dxml);
$pathPdf = '';
$bPdf = false;
if ($comPdf === '1') {
    $bPdf = true;
    $logo = 'images/logo.jpg';
    if (strpos($xml, 'recebidas')) {
        $logo = '';
    }
    $docxml = FilesFolders::readFile($xml);
    $danfe = new Danfe($docxml, 'P', 'A4', $logo, 'I', '');
    $id = $danfe->montaDANFE();
    $pathPdf = '../base/' . $id . '.pdf';
    $pdf = $danfe->printDANFE($pathPdf, 'F');
}
$mail = new Mail();
$resp = $mail->envia($xml, $para, $bPdf, $pathPdf);
if ($resp === true) {
    echo "SUCESSO NFe n. {$chave}, enviada para {$para}.";
} else {
    echo "FRACASSO!! houve algum problema. {$mail->error}";
}
if ($comPdf && is_file($pathPdf)) {
    unlink($pathPdf);
}
Пример #19
0
 public function mySent($role, $school, $id, $user)
 {
     if ($role == 2) {
         $mails = Mail::where('user_id', $user->id)->where('trash_sender', 0)->where('client_id', $id)->where('from', $role)->where('school_id', $school->id)->get();
     } else {
         $mails = Mail::where('user_id', $user->id)->where('trash_sender', 0)->where('admin_id', $id)->where('from', $role)->where('school_id', $school->id)->get();
     }
     return $mails;
 }
Пример #20
0
 /**
  * Get the paginated list of email records from the databased
  *
  * @param int $limit
  * @param null $search
  * @return mixed
  */
 public function getMailLogPaginated($limit = 20, $search = null)
 {
     $query = $this->model->query();
     return $this->paginateAndFilterResults($limit, $search, $query);
 }
Пример #21
0
 public function yourMail()
 {
     $mails = Mail::where('user_id', Auth::user()->id)->orderBy('updated_at', 'DESC')->get();
     return view('user.yourMail')->with('mails', $mails);
 }
Пример #22
0
 /**
  * Remove the specified resource from storage.
  *
  * @param  int $id
  * @param Request $request
  * @return Response
  */
 public function destroy($id, Request $request)
 {
     $message = Mail::findOrFail($id);
     if ($message->canBeDeletedBy($request->user())) {
         $message->delete();
         return back()->with('message', "Message Deleted");
     }
     return back()->with('error', "Sorry! You are not authorized.");
 }
Пример #23
0
 public function reopen_buyer()
 {
     $subject = $this->user->fname . ', your project has been active.';
     $email_view = 'emails.jobs/project_reopened';
     $data = array('job' => $this, 'job_url' => $this->plink(), 'from' => NOTIFICATION_EMAIL, 'from_name' => NOTIFICATION_NAME, 'to' => '*****@*****.**', 'fname' => $this->user->fname, 'sender_name' => NOTIFICATION_NAME, 'subject' => $subject);
     Mail::send($email_view, $data, function ($message) use($data) {
         $message->to($data['to'], $data['fname'])->subject($data['subject']);
         $message->from($data['from'], $data['from_name']);
     });
     return TRUE;
 }
Пример #24
0
 public function handleAdminEditMailStatus($id)
 {
     $mail = Mail::find($id);
     $status = Request::get('status');
     $mail->status = $status;
     $mail->save();
     return redirect('admin/mails')->with('msg', 'เปลี่ยนสถานะเรียบร้อย');
 }
Пример #25
0
 public function mailDetails($id)
 {
     $mail = Mail::find($id);
     if ($mail->user_id != Auth::user()->id) {
         return redirect('home')->with("error", "เกิดข้อผิดพลาด");
     } else {
         $mail_type = DB::table('mailtypes')->where('id', $mail->mail_type_id)->first();
         return view('mail.mailDetails')->with('mail_type', $mail_type)->with('mail', $mail);
     }
 }
Пример #26
0
 public function getShowMail($id)
 {
     $mail = \App\Mail::findOrFail($id);
     if (Auth::user()->id != $mail->sender_id && Auth::user()->id != $mail->reciever_id) {
         throw new \Exception("Not Authorised");
     }
     // If the current viewer is reciever and he is viewing it for first time
     if ($mail->reciever->id == Auth::user()->id && $mail->seen_at == null) {
         $mail->seen_at = \Carbon\Carbon::now();
         $mail->save();
     }
     return view('user.showmail')->with('mail', $mail);
 }
Пример #27
0
 public function email_seller_service_purchase()
 {
     $data = array('workstream' => $this, 'from' => NOTIFICATION_EMAIL, 'from_name' => NOTIFICATION_NAME, 'to' => $this->seller->email, 'fname' => $this->seller->fname, 'sender_name' => NOTIFICATION_NAME, 'subject' => $this->seller->fname . ' you have received an order for your service. ID: #' . $this->proposal->id);
     Mail::send('emails.workstream/seller_service_purchase', $data, function ($message) use($data) {
         $message->to($data['to'], $data['fname'])->subject($data['subject']);
         $message->from($data['from'], $data['from_name']);
     });
     return TRUE;
 }