-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(MailController, mail view) -start customizing mail view, create …
…new function to handle the whole emailing process(wip)
- Loading branch information
Showing
11 changed files
with
118 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,6 +6,7 @@ | |
use Symfony\Component\HttpFoundation\Response; | ||
//use App\Mail\ContactUser; | ||
use App\Mail\SendEmail; | ||
use App\Models\Users; | ||
//use App\Models\Subscriber; | ||
use Illuminate\Support\Facades\Mail; | ||
use Illuminate\Support\Facades\Validator; | ||
|
@@ -36,8 +37,33 @@ public function send(Request $request) | |
|
||
|
||
|
||
public function hello() | ||
{ | ||
return response()->json('hello'); | ||
public function hello() | ||
{ | ||
return response()->json('hello'); | ||
} | ||
|
||
public function contactUser(Request $request) | ||
{ | ||
$senderId = $request->sender_user_id; | ||
$receiverId = $request->receiver_user_id; | ||
$messageContent = $request->message_content; | ||
|
||
$senderInfo = Users::where('id', '=', $senderId)->select('firstname', 'email_address')->get(); | ||
$receiverInfo = Users::where('id', '=', $receiverId)->select('firstname', 'email_address')->get(); | ||
|
||
foreach ($senderInfo as $si) { | ||
$senderName=$si->firstname; | ||
$senderMail=$si->email_address; | ||
} | ||
foreach ($receiverInfo as $ri) { | ||
$receiverName=$ri->firstname; | ||
$receiverMail=$ri->email_address; | ||
} | ||
|
||
|
||
$monEmail = '[email protected]'; | ||
Mail::to($monEmail)->send(new SendEmail($monEmail, $senderName, $senderMail, $receiverName, $receiverMail, $messageContent)); | ||
|
||
return response()->json(['status' => 'success', 'message' => 'Email sent Successfully', 'data' => $monEmail]); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,16 @@ | ||
@component('mail::message') | ||
# Introduction | ||
# Toc toc, on a du courrier pour toi ! | ||
|
||
Hello <b>{{ $email }}</b>, | ||
Bonjour <b>{{ $receiverName }}</b>, | ||
|
||
The body of your message. | ||
{{$senderName}} t'a envoyé un message ! | ||
|
||
@component('mail::button', ['url' => '']) | ||
Button Text | ||
@component('mail::panel') | ||
{{$messageContent}} | ||
@endcomponent | ||
|
||
Thanks,<br> | ||
meetDev | ||
@endcomponent | ||
Tu peux lui répondre à l'adresse suivante: {{$senderMail}} . | ||
|
||
En te souhaitant une bonne journée, <br> | ||
L'équipe meetdev | ||
@endcomponent |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,6 +5,9 @@ | |
use App\Http\Controllers\MessagesController; | ||
use App\Http\Controllers\UsersController; | ||
use App\Http\Controllers\EmailController; | ||
use App\Mail\SendEmail; | ||
|
||
|
||
|
||
/* | ||
|-------------------------------------------------------------------------- | ||
|
@@ -84,7 +87,17 @@ | |
$router->post('/login', 'UsersController@login'); | ||
$router->get('/send/email', 'MailController@send'); | ||
$router->get('/send/hello', 'MailController@hello'); | ||
$router->get('/contact', 'MailController@contactUser'); | ||
|
||
// $router->get('/search-results', 'UsersController@getDevSearchResults'); | ||
}); | ||
|
||
/*Route::get('/mailable', function () { | ||
$email = "[email protected]"; | ||
$sm = new App\Mail\SendEmail($email); | ||
$markdown = new \Illuminate\Mail\Markdown(View(), config('mail.markdown')); | ||
//$data = "[email protected]"; | ||
return $markdown->render($sm->markdown); | ||
});*/ | ||
|