File tree Expand file tree Collapse file tree 3 files changed +20
-7
lines changed Expand file tree Collapse file tree 3 files changed +20
-7
lines changed Original file line number Diff line number Diff line change @@ -51,7 +51,17 @@ MAIL_ENCRYPTION=ssl
5151Once the credentials are properly configured, you can send a test email using Acorn's CLI:
5252
5353``` sh
54- $ wp acorn mail:test [--to= ]
54+ $ wp acorn mail:test [--to= ] [--subject= ] [--body= ]
55+ ```
56+
57+ You can customize the test email subject and body:
58+
59+ ``` sh
60+ # Test with custom subject and body
61+ $ wp acorn mail:test --subject=" Deploy Test" --body=" Deployment successful"
62+
63+ # Test with custom recipient
64+ $ wp acorn mail:test
[email protected] 5565```
5666
5767If any errors are detected, they will be printed to console.
Original file line number Diff line number Diff line change @@ -13,7 +13,7 @@ class AcornMailServiceProvider extends ServiceProvider
1313 */
1414 public function register ()
1515 {
16- $ this ->app ->singleton (' Roots\ AcornMail' , fn () => AcornMail::make ($ this ->app ));
16+ $ this ->app ->singleton (AcornMail::class , fn () => AcornMail::make ($ this ->app ));
1717 }
1818
1919 /**
@@ -30,6 +30,6 @@ public function boot()
3030 ]);
3131 }
3232
33- $ this ->app ->make (' Roots\ AcornMail' );
33+ $ this ->app ->make (AcornMail::class );
3434 }
3535}
Original file line number Diff line number Diff line change 44
55use Illuminate \Console \Command ;
66use Illuminate \Support \Str ;
7+ use Roots \AcornMail \AcornMail ;
78
89class MailTestCommand extends Command
910{
@@ -13,7 +14,9 @@ class MailTestCommand extends Command
1314 * @var string
1415 */
1516 protected $ signature = 'mail:test
16- {--to= : The email address to send the test email to.} ' ;
17+ {--to= : The email address to send the test email to.}
18+ {--subject=Test email : The subject of the test email}
19+ {--body=This is a test email from WordPress. : The body of the test email} ' ;
1720
1821 /**
1922 * The console command description.
@@ -47,7 +50,7 @@ class MailTestCommand extends Command
4750 */
4851 public function handle ()
4952 {
50- $ package = app (' Roots\ AcornMail' );
53+ $ package = app ()-> make ( AcornMail::class );
5154
5255 if (! $ package ->configured ()) {
5356 $ this ->components ->error ('The mail SMTP configuration is not set. ' );
@@ -81,8 +84,8 @@ public function handle()
8184
8285 $ mail = wp_mail (
8386 $ recipient ,
84- ' Test Email ' ,
85- ' This is a test email from WordPress. '
87+ $ this -> option ( ' subject ' ) ,
88+ $ this -> option ( ' body ' )
8689 );
8790
8891 if ($ mail ) {
You can’t perform that action at this time.
0 commit comments