{"id":577,"date":"2023-11-01T05:15:04","date_gmt":"2023-11-01T05:15:04","guid":{"rendered":"https:\/\/rishikantsri.in\/blog\/?p=577"},"modified":"2023-11-01T06:17:04","modified_gmt":"2023-11-01T06:17:04","slug":"sending-email-using-google-smtp-configurationsupdated","status":"publish","type":"post","link":"https:\/\/rishikantsri.in\/blog\/sending-email-using-google-smtp-configurationsupdated\/","title":{"rendered":"Sending Email using google smtp configurations(updated)"},"content":{"rendered":"\n<p>To use a Google App Password with Laravel 8&#8217;s <code>.env<\/code> email SMTP configuration, you&#8217;ll need to set up an App Password in your Google account and then configure your Laravel application. Here are the steps:<\/p>\n\n\n\n<ol>\n<li><strong>Create a Google App Password<\/strong>:<\/li>\n<\/ol>\n\n\n\n<ul>\n<li>Log in to your Google account.<\/li>\n\n\n\n<li>Go to your Google account settings.<\/li>\n<\/ul>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" loading=\"lazy\" width=\"1024\" height=\"450\" src=\"https:\/\/rishikantsri.in\/blog\/wp-content\/uploads\/2023\/11\/image-2-1024x450.png\" alt=\"\" class=\"wp-image-583\" srcset=\"https:\/\/rishikantsri.in\/blog\/wp-content\/uploads\/2023\/11\/image-2-1024x450.png 1024w, https:\/\/rishikantsri.in\/blog\/wp-content\/uploads\/2023\/11\/image-2-300x132.png 300w, https:\/\/rishikantsri.in\/blog\/wp-content\/uploads\/2023\/11\/image-2-768x338.png 768w, https:\/\/rishikantsri.in\/blog\/wp-content\/uploads\/2023\/11\/image-2.png 1490w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<ul>\n<li>Search for App Password, then click on App Password in drop-down menu<\/li>\n<\/ul>\n\n\n\n<p><\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" loading=\"lazy\" width=\"1024\" height=\"384\" src=\"https:\/\/rishikantsri.in\/blog\/wp-content\/uploads\/2023\/11\/image-3-1024x384.png\" alt=\"\" class=\"wp-image-585\" srcset=\"https:\/\/rishikantsri.in\/blog\/wp-content\/uploads\/2023\/11\/image-3-1024x384.png 1024w, https:\/\/rishikantsri.in\/blog\/wp-content\/uploads\/2023\/11\/image-3-300x113.png 300w, https:\/\/rishikantsri.in\/blog\/wp-content\/uploads\/2023\/11\/image-3-768x288.png 768w, https:\/\/rishikantsri.in\/blog\/wp-content\/uploads\/2023\/11\/image-3.png 1423w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<ul>\n<li>Enter App name<\/li>\n<\/ul>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" loading=\"lazy\" width=\"1024\" height=\"629\" src=\"https:\/\/rishikantsri.in\/blog\/wp-content\/uploads\/2023\/11\/image-5-1024x629.png\" alt=\"\" class=\"wp-image-587\" srcset=\"https:\/\/rishikantsri.in\/blog\/wp-content\/uploads\/2023\/11\/image-5-1024x629.png 1024w, https:\/\/rishikantsri.in\/blog\/wp-content\/uploads\/2023\/11\/image-5-300x184.png 300w, https:\/\/rishikantsri.in\/blog\/wp-content\/uploads\/2023\/11\/image-5-768x472.png 768w, https:\/\/rishikantsri.in\/blog\/wp-content\/uploads\/2023\/11\/image-5.png 1281w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<ul>\n<li>Click &#8220;Create.&#8221; Google will generate a 16-character App Password that you should copy. Keep this password secure, as you won&#8217;t be able to see it again.<\/li>\n<\/ul>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" loading=\"lazy\" width=\"1022\" height=\"710\" src=\"https:\/\/rishikantsri.in\/blog\/wp-content\/uploads\/2023\/11\/image-6.png\" alt=\"\" class=\"wp-image-588\" srcset=\"https:\/\/rishikantsri.in\/blog\/wp-content\/uploads\/2023\/11\/image-6.png 1022w, https:\/\/rishikantsri.in\/blog\/wp-content\/uploads\/2023\/11\/image-6-300x208.png 300w, https:\/\/rishikantsri.in\/blog\/wp-content\/uploads\/2023\/11\/image-6-768x534.png 768w\" sizes=\"(max-width: 1022px) 100vw, 1022px\" \/><\/figure>\n\n\n\n<ol>\n<li><strong>Update Laravel&#8217;s .env File<\/strong>: Open your Laravel project&#8217;s <code>.env<\/code> file and configure the SMTP settings to use the App Password:<\/li>\n<\/ol>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" loading=\"lazy\" width=\"447\" height=\"302\" src=\"https:\/\/rishikantsri.in\/blog\/wp-content\/uploads\/2023\/11\/image-7.png\" alt=\"\" class=\"wp-image-589\" srcset=\"https:\/\/rishikantsri.in\/blog\/wp-content\/uploads\/2023\/11\/image-7.png 447w, https:\/\/rishikantsri.in\/blog\/wp-content\/uploads\/2023\/11\/image-7-300x203.png 300w\" sizes=\"(max-width: 447px) 100vw, 447px\" \/><\/figure>\n\n\n\n<p>Password generated in the previous step.<\/p>\n\n\n\n<ol start=\"3\">\n<li><strong>Less Secure Apps and Your Google Account<\/strong>: By default, Google may block sign-ins from apps that it considers less secure. Since Laravel uses SMTP to send emails, you might need to enable &#8220;Less secure apps&#8221; in your Google account settings. To do this:<\/li>\n<\/ol>\n\n\n\n<ul>\n<li>Go to your Google Account settings.<\/li>\n\n\n\n<li>In the &#8220;Security&#8221; section, find the &#8220;Less secure app access&#8221; option.<\/li>\n\n\n\n<li>Turn on the &#8220;Allow less secure apps&#8221; toggle. Keep in mind that enabling &#8220;Less secure apps&#8221; makes your account potentially less secure. It&#8217;s recommended to use two-factor authentication and only enable this option temporarily for your application.<\/li>\n<\/ul>\n\n\n\n<ol start=\"3\">\n<li><strong>Clear Configuration Cache<\/strong>: After updating your <code>.env<\/code> file, you should clear your configuration cache to ensure Laravel uses the new settings:<\/li>\n<\/ol>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:1.125rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#b392f0;--cbp-line-number-width:9.88751220703125px;line-height:1.625rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:flex;align-items:center;padding:16px 0 0 16px;width:100%;text-align:left;background-color:#1f1f1f\"><span style=\"background:#a37ced;padding:0.3rem 0.5rem 0.2rem;border-radius:1rem;font-size:0.8em;line-height:1;height:1.25rem;text-align:center;display:inline-flex;align-items:center;justify-content:center;color:#1f1f1f\">PHP<\/span><\/span><span role=\"button\" tabindex=\"0\" data-code=\"   php artisan config:cache\" style=\"color:#b392f0;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M4.5 12.75l6 6 9-13.5\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6\"><\/path><\/svg><\/span><pre class=\"shiki min-dark\" style=\"background-color: #1f1f1f\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #B392F0\">   php artisan config:cache<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<ol start=\"5\">\n<li><strong>Testing<\/strong>: You can now test your email sending functionality in Laravel to ensure that it&#8217;s using the Google App Password for authentication. You can send a test email to confirm that everything is working as expected.<\/li>\n<\/ol>\n\n\n\n<p>That&#8217;s it! You&#8217;ve configured Laravel to use a Google App Password for SMTP email authentication. Remember to keep your App Password secure, as it provides access to your Gmail account for sending emails.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>To use a Google App Password with Laravel 8&#8217;s .env email SMTP configuration, you&#8217;ll need to set up an App Password in your Google account and then configure your Laravel application. Here are the steps: Password generated in the previous step. That&#8217;s it! You&#8217;ve configured Laravel to use a Google App Password for SMTP email [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1,81,11],"tags":[25,3,4],"_links":{"self":[{"href":"https:\/\/rishikantsri.in\/blog\/wp-json\/wp\/v2\/posts\/577"}],"collection":[{"href":"https:\/\/rishikantsri.in\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/rishikantsri.in\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/rishikantsri.in\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/rishikantsri.in\/blog\/wp-json\/wp\/v2\/comments?post=577"}],"version-history":[{"count":3,"href":"https:\/\/rishikantsri.in\/blog\/wp-json\/wp\/v2\/posts\/577\/revisions"}],"predecessor-version":[{"id":592,"href":"https:\/\/rishikantsri.in\/blog\/wp-json\/wp\/v2\/posts\/577\/revisions\/592"}],"wp:attachment":[{"href":"https:\/\/rishikantsri.in\/blog\/wp-json\/wp\/v2\/media?parent=577"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/rishikantsri.in\/blog\/wp-json\/wp\/v2\/categories?post=577"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/rishikantsri.in\/blog\/wp-json\/wp\/v2\/tags?post=577"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}