{"id":14,"date":"2021-01-14T07:34:44","date_gmt":"2021-01-14T07:34:44","guid":{"rendered":"https:\/\/mouryasolutions.in\/blog\/?p=14"},"modified":"2023-01-29T18:19:10","modified_gmt":"2023-01-29T18:19:10","slug":"imap-setting-in-laravel","status":"publish","type":"post","link":"https:\/\/mouryasolutions.in\/blog\/imap-setting-in-laravel\/","title":{"rendered":"IMAP Settings in Laravel"},"content":{"rendered":"<div class=\"post-content\">\n<blockquote class=\"wp-block-quote\">\n<p>In Laravel, you can use the built-in Mail facade to receive emails through IMAP. Here is an example of how to set up IMAP in Laravel:<\/p>\n<\/blockquote>\n\n\n\n<h4>First, you need to add the following code to the <code>.env<\/code> file:<\/h4>\n\n\n\n<pre class=\"wp-block-code\"><code>MAIL_DRIVER=imap\r\nMAIL_HOST=imap.example.com\r\nMAIL_PORT=993\r\nMAIL_USERNAME=your-email-address\r\nMAIL_PASSWORD=your-email-password\r\nMAIL_ENCRYPTION=ssl\r\n<\/code><\/pre>\n\n\n\n<p>Note: Replace the <code>MAIL_HOST<\/code> and other configuration values with the correct values for your IMAP server.<\/p>\n\n\n\n<h4>Next, you can use the following code to receive emails in Laravel:<\/h4>\n\n\n\n<pre class=\"wp-block-code\"><code>use Illuminate\\Support\\Facades\\Mail;\r\n\r\n$emails = Mail::all();\r\nforeach ($emails as $email) {\r\n    echo $email->subject;\r\n    echo $email->body;\r\n}\r\n<\/code><\/pre>\n\n\n\n<p>Note: This code uses the built-in Mail facade to get all emails and loop through them, displaying the subject and body of each email.<\/p>\n<\/div><!-- AddThis Advanced Settings generic via filter on the_content --><!-- AddThis Share Buttons generic via filter on the_content -->","protected":false},"excerpt":{"rendered":"<p>In Laravel, you can use the built-in Mail facade to<a href=\"https:\/\/mouryasolutions.in\/blog\/imap-setting-in-laravel\/\">Read More<i class=\"fa fa-long-arrow-right\" aria-hidden=\"true\"><\/i><\/a><!-- AddThis Advanced Settings generic via filter on get_the_excerpt --><!-- AddThis Share Buttons generic via filter on get_the_excerpt --><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[2],"tags":[],"_links":{"self":[{"href":"https:\/\/mouryasolutions.in\/blog\/wp-json\/wp\/v2\/posts\/14"}],"collection":[{"href":"https:\/\/mouryasolutions.in\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mouryasolutions.in\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mouryasolutions.in\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mouryasolutions.in\/blog\/wp-json\/wp\/v2\/comments?post=14"}],"version-history":[{"count":4,"href":"https:\/\/mouryasolutions.in\/blog\/wp-json\/wp\/v2\/posts\/14\/revisions"}],"predecessor-version":[{"id":480,"href":"https:\/\/mouryasolutions.in\/blog\/wp-json\/wp\/v2\/posts\/14\/revisions\/480"}],"wp:attachment":[{"href":"https:\/\/mouryasolutions.in\/blog\/wp-json\/wp\/v2\/media?parent=14"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mouryasolutions.in\/blog\/wp-json\/wp\/v2\/categories?post=14"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mouryasolutions.in\/blog\/wp-json\/wp\/v2\/tags?post=14"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}