File tree 4 files changed +79
-2
lines changed
4 files changed +79
-2
lines changed Original file line number Diff line number Diff line change @@ -13,8 +13,8 @@ public function new_mail(Request $request)
13
13
$ details = [
14
14
'to ' => $ request ->to ,
15
15
'from ' => $ request ->from ,
16
- 'subject ' => $ request ->subject ,,
17
- 'title ' => $ request ->title ,,
16
+ 'subject ' => $ request ->subject ,
17
+ 'title ' => $ request ->title ,
18
18
"body " => $ request ->body
19
19
];
20
20
@@ -32,6 +32,32 @@ public function new_mail(Request $request)
32
32
'data ' => $ details ,
33
33
'message ' => 'Your details mailed successfully '
34
34
]);
35
+ }
36
+
37
+ public function new_mail_md (Request $ request )
38
+ {
39
+ $ details = [
40
+ 'to ' => $ request ->to ,
41
+ 'from ' => $ request ->from ,
42
+ 'subject ' => $ request ->subject ,
43
+ 'title ' => $ request ->title ,
44
+ "body " => $ request ->body
45
+ ];
46
+
47
+ \Mail::to ($ request ->to )->send (new \App \Mail \MdMail ($ details ));
48
+
49
+ if (Mail::failures ()) {
50
+ return response ()->json ([
51
+ 'status ' => false ,
52
+ 'data ' => $ details ,
53
+ 'message ' => 'Nnot sending mail.. retry again... '
54
+ ]);
55
+ }
56
+ return response ()->json ([
57
+ 'status ' => true ,
58
+ 'data ' => $ details ,
59
+ 'message ' => 'Your details mailed successfully '
60
+ ]);
35
61
36
62
}
37
63
Original file line number Diff line number Diff line change
1
+ <?php
2
+
3
+ namespace App \Mail ;
4
+
5
+ use Illuminate \Bus \Queueable ;
6
+ use Illuminate \Contracts \Queue \ShouldQueue ;
7
+ use Illuminate \Mail \Mailable ;
8
+ use Illuminate \Queue \SerializesModels ;
9
+
10
+ class MdMail extends Mailable
11
+ {
12
+ use Queueable, SerializesModels;
13
+ public $ details ;
14
+ /**
15
+ * Create a new message instance.
16
+ *
17
+ * @return void
18
+ */
19
+ public function __construct ($ details )
20
+ {
21
+ $ this ->details = $ details ;
22
+ }
23
+
24
+ /**
25
+ * Build the message.
26
+ *
27
+ * @return $this
28
+ */
29
+ public function build ()
30
+ {
31
+ return $ this ->subject ($ this ->details ['subject ' ])
32
+ ->markdown ('email.markdown ' )
33
+ ->from ($ this ->details ['from ' ], 'Powered by GitLeaf ' );
34
+ }
35
+ }
Original file line number Diff line number Diff line change
1
+ @component (' mail::message' )
2
+ # {{ $details [' title' ] } }
3
+
4
+ {{ date (' Y.m.d H:m:s' )} }
5
+ <hr >
6
+ {{ $details [' body' ] } }
7
+
8
+ @component (' mail::button' , [' url' => ' #' ] )
9
+ View n browser
10
+ @endcomponent
11
+
12
+ Thanks for using,<br >
13
+ <img src =" https://gitleaf.com/img/logo.png" alt =" logo" height =" 36" ><br />
14
+ @endcomponent
Original file line number Diff line number Diff line change 19
19
});
20
20
21
21
Route::get ('prepare ' , 'MailController@new_mail ' );
22
+
23
+ Route::get ('prepare:md ' , 'MailController@new_mail_md ' );
You can’t perform that action at this time.
0 commit comments