How to test sending Laravel email from command prompt

If you want to test if you can send email from Laravel using only command prompt, here is how ..

  • First open your favorite command prompt
  • Go to your root folder of your website (i.e cd c:\xampp\htdocs\mySite )
  • Run this command: php artisan tinker
  • Mail::send(‘myView‘, [], function ($message) { $message->to(‘yourEmail@test.com’)->subject(‘Sending mail is OK’); });

How to redirect everything to HTTPS

Redirect all non-HTTPS traffic to HTTPS using htaccess

<IfModule mod_rewrite.c>
 RewriteEngine On
 RewriteCond %{HTTPS} !on [NC]
 RewriteRule ^(.*)$ https://%{HTTP_HOST}/$1 [R=301,L]
</IfModule>

for more htaccess tips, go to this url:

https://www.leaseweb.com/labs/tag/htaccess/

How to configure virtual hosts on Apache on Windows

If you are using Apache on your Windows machine and want to set up virtual hosts so you can type something like this “www.myDomain.tst” in your browser and it’ll direct you to your local hosted site … you have to edit this file:

C:\WINDOWS\system32\drivers\etc\hosts

Add a new line with this text
127.0.0.1  myDomain

Open apache\conf\extra\httpd-vhosts.conf file and add these lines:

<VirtualHost *:80>
DocumentRoot path_to_your_document_root
ServerName myDomain
</VirtualHost>