{"id":1855,"date":"2024-02-20T11:50:05","date_gmt":"2024-02-20T11:50:05","guid":{"rendered":"https:\/\/www.devopsfreelancer.com\/blog\/?p=1855"},"modified":"2024-02-29T11:59:06","modified_gmt":"2024-02-29T11:59:06","slug":"how-to-send-attachment-files-to-email-using-laravel-upload-document-and-send-mail-in-laravel","status":"publish","type":"post","link":"https:\/\/www.devopsfreelancer.com\/blog\/how-to-send-attachment-files-to-email-using-laravel-upload-document-and-send-mail-in-laravel\/","title":{"rendered":"How to send attachment files to email using laravel | Upload Document and send Mail in Laravel"},"content":{"rendered":"\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"600\" height=\"315\" src=\"https:\/\/www.devopsfreelancer.com\/blog\/wp-content\/uploads\/2024\/02\/image-129.png\" alt=\"\" class=\"wp-image-1856\" srcset=\"https:\/\/www.devopsfreelancer.com\/blog\/wp-content\/uploads\/2024\/02\/image-129.png 600w, https:\/\/www.devopsfreelancer.com\/blog\/wp-content\/uploads\/2024\/02\/image-129-300x158.png 300w\" sizes=\"auto, (max-width: 600px) 100vw, 600px\" \/><\/figure>\n\n\n\n<p id=\"64d2\">In this tutorial im going to demonstrate how to upload document and send data via Email. Please follow some easy steps mentioned below.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"215d\">First let\u2019s go to install laravel project<a href=\"https:\/\/laravelamit.medium.com\/?source=post_page-----98648014757c--------------------------------\"><\/a><\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code>composer create-project laravel\/laravel learning-project<\/code><\/pre>\n\n\n\n<p><em>lets go to\u00a0<\/em><strong><em>.env folder<\/em><\/strong><em>\u00a0and put database name and connect to database.<\/em><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>DB_CONNECTION=mysql\r\nDB_HOST=127.0.0.1\r\nDB_PORT=3306\r\nDB_DATABASE=learning-project\r\nDB_USERNAME=root\r\nDB_PASSWORD=<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">Let\u2019s to create Controller<\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code>php artisan make:controller SendEmailController\r<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"720\" height=\"130\" src=\"https:\/\/www.devopsfreelancer.com\/blog\/wp-content\/uploads\/2024\/02\/image-130.png\" alt=\"\" class=\"wp-image-1857\" srcset=\"https:\/\/www.devopsfreelancer.com\/blog\/wp-content\/uploads\/2024\/02\/image-130.png 720w, https:\/\/www.devopsfreelancer.com\/blog\/wp-content\/uploads\/2024\/02\/image-130-300x54.png 300w\" sizes=\"auto, (max-width: 720px) 100vw, 720px\" \/><\/figure>\n\n\n\n<p>Go to your controller SendEmailController and paste below code<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;?php\r\n\r\nnamespace App\\Http\\Controllers;\r\n\r\nuse Illuminate\\Http\\Request;\r\nuse Illuminate\\Support\\Facades\\Mail;\r\nuse App\\Mail\\SendMail;\r\nuse App\\UploadImage;\r\n\r\nclass SendEmailController extends Controller\r\n{\r\n\r\n    function index()\r\n    {\r\n     return view('send_email');\r\n    }\r\n    public function store(Request $request){\r\n        $request->validate(&#91;\r\n        'name'=>'required',\r\n        'email' => 'required',\r\n        'image'=> 'required',\r\n        ]);\r\n\r\n        $resume = time() . '.' . $request&#91;'image']->getClientOriginalExtension();\r\n        $imagesendbymailwithstore= new UploadImage();\r\n        $imagesendbymailwithstore->name =  $request->name;\r\n        $imagesendbymailwithstore->email = $request->email;\r\n        $imagesendbymailwithstore->image = $resume;\r\n        $imagesendbymailwithstore->save();\r\n\r\n        \/\/ for mailling function working\r\n        $imagesendbymailwithstore = array(\r\n            'name' => $request->name,\r\n            'email' => $request->email,\r\n            'image' => \t$request->image,\r\n\r\n        );\r\n        Mail::to($imagesendbymailwithstore&#91;'email'])->send(new SendMail($imagesendbymailwithstore));\r\n        $request&#91;'image']->move(base_path() . '\/storage\/app\/public', $resume);\r\n        return back()->with('success', 'Thanks for contacting us!');\r\n    }\r\n}<\/code><\/pre>\n\n\n\n<p id=\"0523\"><strong>Next create model and migration file so run below code.<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>php artisan make:model UploadImage -m<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"720\" height=\"150\" src=\"https:\/\/www.devopsfreelancer.com\/blog\/wp-content\/uploads\/2024\/02\/image-131.png\" alt=\"\" class=\"wp-image-1858\" srcset=\"https:\/\/www.devopsfreelancer.com\/blog\/wp-content\/uploads\/2024\/02\/image-131.png 720w, https:\/\/www.devopsfreelancer.com\/blog\/wp-content\/uploads\/2024\/02\/image-131-300x63.png 300w\" sizes=\"auto, (max-width: 720px) 100vw, 720px\" \/><\/figure>\n\n\n\n<p id=\"a9d3\">Next step go to your migration and and table<\/p>\n\n\n\n<p id=\"855e\"><strong>database\\migrations\\2020_10_23_070450_create_upload_images_table.php<\/strong><\/p>\n\n\n\n<p id=\"184c\">Add follow column name<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$table->string('name');\r\n$table->string('email');\r\n$table->string('image');<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"720\" height=\"244\" src=\"https:\/\/www.devopsfreelancer.com\/blog\/wp-content\/uploads\/2024\/02\/image-132.png\" alt=\"\" class=\"wp-image-1859\" srcset=\"https:\/\/www.devopsfreelancer.com\/blog\/wp-content\/uploads\/2024\/02\/image-132.png 720w, https:\/\/www.devopsfreelancer.com\/blog\/wp-content\/uploads\/2024\/02\/image-132-300x102.png 300w\" sizes=\"auto, (max-width: 720px) 100vw, 720px\" \/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">Now migrate the table<\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code>php artisan migrate<\/code><\/pre>\n\n\n\n<p>Create a Mailable class first you have to create an account in mailtrap or click this url\u00a0<a href=\"https:\/\/mailtrap.io\/\" target=\"_blank\" rel=\"noreferrer noopener\">https:\/\/mailtrap.io\/<\/a>\u00a0after create account you have to copy Username: XXXXXXXXX and password: XXXXXXXXXX and put in .env file see pic<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"700\" height=\"337\" src=\"https:\/\/www.devopsfreelancer.com\/blog\/wp-content\/uploads\/2024\/02\/image-133.png\" alt=\"\" class=\"wp-image-1860\" srcset=\"https:\/\/www.devopsfreelancer.com\/blog\/wp-content\/uploads\/2024\/02\/image-133.png 700w, https:\/\/www.devopsfreelancer.com\/blog\/wp-content\/uploads\/2024\/02\/image-133-300x144.png 300w\" sizes=\"auto, (max-width: 700px) 100vw, 700px\" \/><\/figure>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"700\" height=\"268\" src=\"https:\/\/www.devopsfreelancer.com\/blog\/wp-content\/uploads\/2024\/02\/image-134.png\" alt=\"\" class=\"wp-image-1861\" srcset=\"https:\/\/www.devopsfreelancer.com\/blog\/wp-content\/uploads\/2024\/02\/image-134.png 700w, https:\/\/www.devopsfreelancer.com\/blog\/wp-content\/uploads\/2024\/02\/image-134-300x115.png 300w\" sizes=\"auto, (max-width: 700px) 100vw, 700px\" \/><\/figure>\n\n\n\n<p id=\"914b\">Now we are ready for make mailable class for this we have to go teminal and write following<\/p>\n\n\n\n<p id=\"43e3\">Then make a view page&nbsp;<strong>send_email.blade.php<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;!DOCTYPE html>\r\n&lt;html>\r\n &lt;head>\r\n  &lt;title>  send a mail with Attachment &lt;\/title>\r\n  &lt;script src=\"https:\/\/ajax.googleapis.com\/ajax\/libs\/jquery\/3.1.0\/jquery.min.js\">&lt;\/script>\r\n  &lt;link rel=\"stylesheet\" href=\"https:\/\/maxcdn.bootstrapcdn.com\/bootstrap\/3.3.6\/css\/bootstrap.min.css\" \/>\r\n  &lt;script src=\"https:\/\/maxcdn.bootstrapcdn.com\/bootstrap\/3.3.7\/js\/bootstrap.min.js\">&lt;\/script>\r\n  &lt;style type=\"text\/css\">\r\n   .box{\r\n    width:600px;\r\n    margin:0 auto;\r\n    border:1px solid #ccc;\r\n   }\r\n   .has-error\r\n   {\r\n    border-color:#cc0000;\r\n    background-color:#ffff99;\r\n   }\r\n  &lt;\/style>\r\n &lt;\/head>\r\n &lt;body>\r\n  &lt;br \/>\r\n  &lt;br \/>\r\n  &lt;br \/>\r\n  &lt;div class=\"container box\">\r\n   &lt;h3 align=\"center\">send a mail with Attachment using laravel 5.8&lt;\/h3>&lt;br \/>\r\n   @if (count($errors) > 0)\r\n    &lt;div class=\"alert alert-danger\">\r\n     &lt;button type=\"button\" class=\"close\" data-dismiss=\"alert\">\u00d7&lt;\/button>\r\n     &lt;ul>\r\n      @foreach ($errors->all() as $error)\r\n       &lt;li>{{ $error }}&lt;\/li>\r\n      @endforeach\r\n     &lt;\/ul>\r\n    &lt;\/div>\r\n   @endif\r\n   @if ($message = Session::get('success'))\r\n   &lt;div class=\"alert alert-success alert-block\">\r\n    &lt;button type=\"button\" class=\"close\" data-dismiss=\"alert\">\u00d7&lt;\/button>\r\n           &lt;strong>{{ $message }}&lt;\/strong>\r\n   &lt;\/div>\r\n   @endif\r\n\r\n&lt;form method=\"post\" action=\"{{ route('sendemail.store') }}\" enctype=\"multipart\/form-data\" role=\"form\" class=\"form-horizontal\" id=\"location\">\r\n    {{ csrf_field() }}\r\n    &lt;div class=\"form-group\">\r\n     &lt;label>Enter Your Name&lt;\/label>\r\n     &lt;input type=\"text\" name=\"name\" class=\"form-control\" value=\"\" \/>\r\n    &lt;\/div>\r\n    &lt;div class=\"form-group\">\r\n     &lt;label>Enter Your Email&lt;\/label>\r\n     &lt;input type=\"text\" name=\"email\" class=\"form-control\" value=\"\" \/>\r\n    &lt;\/div>\r\n\r\n    &lt;div class=\"form-group\">\r\n            &lt;label for=\"resume\" placeholder=\"(resume type *PDF*)\">Document:&lt;span class=\"text-danger font-weight-bold\">*&lt;\/span>&lt;\/label>\r\n            &lt;input type=\"file\" class=\"w-100 p-1\" name=\"image\" value=\"{{old('resume')}}\"\/>\r\n            &lt;label class=\"text-danger mt-1\" >(*File type- PDF &amp; Maximum size 1 MB*)&lt;\/label>\r\n    &lt;\/div>\r\n    &lt;div class=\"form-group\">\r\n     &lt;input type=\"submit\" name=\"send\" class=\"btn btn-info\" value=\"Send\" \/>\r\n    &lt;\/div>\r\n   &lt;\/form>\r\n\r\n  &lt;\/div>\r\n &lt;\/body>\r\n&lt;\/html><\/code><\/pre>\n\n\n\n<p><strong>Next step\u00a0<\/strong>make one blade page resources\/view\/<strong>dynamic_email_template.blade.php<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;p style=\"margin-left:10%;\">First Name - &lt;b>{{ $data&#91;'name'] }} &lt;\/b>&lt;\/p>\r\n&lt;p style=\"margin-left:10%;\">last Name - &lt;b>{{ $data&#91;'email'] }}  &lt;\/b>&lt;\/p>\r\n\r\n\r\n&lt;p>It would be appriciative, if you gone through this feedback.&lt;\/p><\/code><\/pre>\n\n\n\n<p><em>Next one to create\u00a0<\/em><strong><em>SendMail.php<\/em><\/strong><em>\u00a0file run below code.<\/em><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>php artisan make:mail SendMail\r<\/code><\/pre>\n\n\n\n<p id=\"056b\">Next step go to App\\Mail\\SendMail.php and paste below code<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&lt;?php\r\n\r\nnamespace App\\Mail;\r\n\r\nuse Illuminate\\Bus\\Queueable;\r\nuse Illuminate\\Mail\\Mailable;\r\nuse Illuminate\\Queue\\SerializesModels;\r\nuse Illuminate\\Contracts\\Queue\\ShouldQueue;\r\n\r\nclass SendMail extends Mailable\r\n{\r\n    use Queueable, SerializesModels;\r\n    public $imagesendbymailwithstore;\r\n    \/**\r\n     * Create a new message instance.\r\n     *\r\n     * @return void\r\n     *\/\r\n    public function __construct($imagesendbymailwithstore)\r\n    {\r\n        $this->imagesendbymailwithstore = $imagesendbymailwithstore;\r\n    }\r\n\r\n    \/**\r\n     * Build the message.\r\n     *\r\n     * @return $this\r\n     *\/\r\n    public function build()\r\n    {\r\n        return $this->from('info@scmgalaxy.com')\r\n        ->subject('New image from Devops Team')\r\n        ->view('dynamic_email_template')\r\n        ->with('data', $this->imagesendbymailwithstore)\r\n        ->attach($this->imagesendbymailwithstore&#91;'image']->getRealPath(),\r\n            &#91;\r\n                    'as' => $this->imagesendbymailwithstore&#91;'image']->getClientOriginalName(),\r\n                'mime' => $this->imagesendbymailwithstore&#91;'image']->getClientMimeType(),\r\n            ]);\r\n\r\n    }\r\n}<\/code><\/pre>\n\n\n\n<p id=\"9452\"><strong>Next define routes go to your routes\/web.php file and paste below code.<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Route::get('sendemail','SendEmailController@index');Route::post('sendemail.store','SendEmailController@store')-&gt;name('sendemail.store');<\/code><\/pre>\n\n\n\n<p id=\"1c96\">Now run below code and refresh your browser and fill form<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>php artisan serve\r\nhttp:&#47;&#47;127.0.0.1:8000<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"606\" height=\"306\" src=\"https:\/\/www.devopsfreelancer.com\/blog\/wp-content\/uploads\/2024\/02\/image-136.png\" alt=\"\" class=\"wp-image-1863\" srcset=\"https:\/\/www.devopsfreelancer.com\/blog\/wp-content\/uploads\/2024\/02\/image-136.png 606w, https:\/\/www.devopsfreelancer.com\/blog\/wp-content\/uploads\/2024\/02\/image-136-300x150.png 300w\" sizes=\"auto, (max-width: 606px) 100vw, 606px\" \/><\/figure>\n\n\n\n<p id=\"34da\">Thanks i hope its helpfull for you \ud83d\ude4f\ud83d\ude4f<a href=\"https:\/\/medium.com\/tag\/laravel?source=post_page-----98648014757c---------------laravel-----------------\"><\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>In this tutorial im going to demonstrate how to upload document and send data via Email. Please follow some easy steps mentioned below. First let\u2019s go to&#8230; <\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[707,3,610,730],"class_list":["post-1855","post","type-post","status-publish","format-standard","hentry","category-uncategorized","tag-image-upload-in-laravel","tag-laravel","tag-laravel-image-upload","tag-mail-send-in-laravel"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.4 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>How to send attachment files to email using laravel | Upload Document and send Mail in Laravel - DevOps Freelancer<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.devopsfreelancer.com\/blog\/how-to-send-attachment-files-to-email-using-laravel-upload-document-and-send-mail-in-laravel\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to send attachment files to email using laravel | Upload Document and send Mail in Laravel - DevOps Freelancer\" \/>\n<meta property=\"og:description\" content=\"In this tutorial im going to demonstrate how to upload document and send data via Email. Please follow some easy steps mentioned below. First let\u2019s go to...\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.devopsfreelancer.com\/blog\/how-to-send-attachment-files-to-email-using-laravel-upload-document-and-send-mail-in-laravel\/\" \/>\n<meta property=\"og:site_name\" content=\"DevOps Freelancer\" \/>\n<meta property=\"article:author\" content=\"https:\/\/www.facebook.com\/amitsthakurs\/\" \/>\n<meta property=\"article:published_time\" content=\"2024-02-20T11:50:05+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2024-02-29T11:59:06+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.devopsfreelancer.com\/blog\/wp-content\/uploads\/2024\/02\/image-129.png\" \/>\n<meta name=\"author\" content=\"Amit Kumar\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@https:\/\/twitter.com\/amits_thakurs\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Amit Kumar\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.devopsfreelancer.com\\\/blog\\\/how-to-send-attachment-files-to-email-using-laravel-upload-document-and-send-mail-in-laravel\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.devopsfreelancer.com\\\/blog\\\/how-to-send-attachment-files-to-email-using-laravel-upload-document-and-send-mail-in-laravel\\\/\"},\"author\":{\"name\":\"Amit Kumar\",\"@id\":\"https:\\\/\\\/www.devopsfreelancer.com\\\/blog\\\/#\\\/schema\\\/person\\\/22ed4bd82dc04200a2ca541b3e35fc5b\"},\"headline\":\"How to send attachment files to email using laravel | Upload Document and send Mail in Laravel\",\"datePublished\":\"2024-02-20T11:50:05+00:00\",\"dateModified\":\"2024-02-29T11:59:06+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.devopsfreelancer.com\\\/blog\\\/how-to-send-attachment-files-to-email-using-laravel-upload-document-and-send-mail-in-laravel\\\/\"},\"wordCount\":242,\"commentCount\":0,\"image\":{\"@id\":\"https:\\\/\\\/www.devopsfreelancer.com\\\/blog\\\/how-to-send-attachment-files-to-email-using-laravel-upload-document-and-send-mail-in-laravel\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.devopsfreelancer.com\\\/blog\\\/wp-content\\\/uploads\\\/2024\\\/02\\\/image-129.png\",\"keywords\":[\"image-upload-in-laravel\",\"laravel\",\"laravel-image-upload\",\"mail-send-in-laravel\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.devopsfreelancer.com\\\/blog\\\/how-to-send-attachment-files-to-email-using-laravel-upload-document-and-send-mail-in-laravel\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.devopsfreelancer.com\\\/blog\\\/how-to-send-attachment-files-to-email-using-laravel-upload-document-and-send-mail-in-laravel\\\/\",\"url\":\"https:\\\/\\\/www.devopsfreelancer.com\\\/blog\\\/how-to-send-attachment-files-to-email-using-laravel-upload-document-and-send-mail-in-laravel\\\/\",\"name\":\"How to send attachment files to email using laravel | Upload Document and send Mail in Laravel - DevOps Freelancer\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.devopsfreelancer.com\\\/blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.devopsfreelancer.com\\\/blog\\\/how-to-send-attachment-files-to-email-using-laravel-upload-document-and-send-mail-in-laravel\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.devopsfreelancer.com\\\/blog\\\/how-to-send-attachment-files-to-email-using-laravel-upload-document-and-send-mail-in-laravel\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.devopsfreelancer.com\\\/blog\\\/wp-content\\\/uploads\\\/2024\\\/02\\\/image-129.png\",\"datePublished\":\"2024-02-20T11:50:05+00:00\",\"dateModified\":\"2024-02-29T11:59:06+00:00\",\"author\":{\"@id\":\"https:\\\/\\\/www.devopsfreelancer.com\\\/blog\\\/#\\\/schema\\\/person\\\/22ed4bd82dc04200a2ca541b3e35fc5b\"},\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.devopsfreelancer.com\\\/blog\\\/how-to-send-attachment-files-to-email-using-laravel-upload-document-and-send-mail-in-laravel\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.devopsfreelancer.com\\\/blog\\\/how-to-send-attachment-files-to-email-using-laravel-upload-document-and-send-mail-in-laravel\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.devopsfreelancer.com\\\/blog\\\/how-to-send-attachment-files-to-email-using-laravel-upload-document-and-send-mail-in-laravel\\\/#primaryimage\",\"url\":\"https:\\\/\\\/www.devopsfreelancer.com\\\/blog\\\/wp-content\\\/uploads\\\/2024\\\/02\\\/image-129.png\",\"contentUrl\":\"https:\\\/\\\/www.devopsfreelancer.com\\\/blog\\\/wp-content\\\/uploads\\\/2024\\\/02\\\/image-129.png\",\"width\":600,\"height\":315},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.devopsfreelancer.com\\\/blog\\\/how-to-send-attachment-files-to-email-using-laravel-upload-document-and-send-mail-in-laravel\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.devopsfreelancer.com\\\/blog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How to send attachment files to email using laravel | Upload Document and send Mail in Laravel\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.devopsfreelancer.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/www.devopsfreelancer.com\\\/blog\\\/\",\"name\":\"DevOps Freelancer\",\"description\":\"We provide DevOps | SRE | DevSecOps | MLOps Freelancing\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.devopsfreelancer.com\\\/blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.devopsfreelancer.com\\\/blog\\\/#\\\/schema\\\/person\\\/22ed4bd82dc04200a2ca541b3e35fc5b\",\"name\":\"Amit Kumar\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/d76fb4d0f15f7a458f1fd91063b44fbb7e7eb9e724b1c465d885054c2540250f?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/d76fb4d0f15f7a458f1fd91063b44fbb7e7eb9e724b1c465d885054c2540250f?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/d76fb4d0f15f7a458f1fd91063b44fbb7e7eb9e724b1c465d885054c2540250f?s=96&d=mm&r=g\",\"caption\":\"Amit Kumar\"},\"description\":\"Hi I am Amit Kumar Thakur Experienced as s Software Developer with a demonstrated history of working in the information technology and services industry. Skilled in HTML, CSS, Bootstrap4, PHP, Laravel-9 , REST API,FB API,Google API, Youtube Api, Bitbucket,Github,Linux and jQuery. Strong engineering professional focused in Computer\\\/Information Technology Administration and Management. Currently my profile is to Software Developer, analyze the requirement, creating frame for web application, coding and maintenance.\",\"sameAs\":[\"https:\\\/\\\/www.facebook.com\\\/amitsthakurs\\\/\",\"https:\\\/\\\/www.instagram.com\\\/amits_thakurs\\\/\",\"https:\\\/\\\/www.linkedin.com\\\/in\\\/amits-thakurs\\\/\",\"https:\\\/\\\/x.com\\\/https:\\\/\\\/twitter.com\\\/amits_thakurs\"],\"url\":\"https:\\\/\\\/www.devopsfreelancer.com\\\/blog\\\/author\\\/amit\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How to send attachment files to email using laravel | Upload Document and send Mail in Laravel - DevOps Freelancer","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.devopsfreelancer.com\/blog\/how-to-send-attachment-files-to-email-using-laravel-upload-document-and-send-mail-in-laravel\/","og_locale":"en_US","og_type":"article","og_title":"How to send attachment files to email using laravel | Upload Document and send Mail in Laravel - DevOps Freelancer","og_description":"In this tutorial im going to demonstrate how to upload document and send data via Email. Please follow some easy steps mentioned below. First let\u2019s go to...","og_url":"https:\/\/www.devopsfreelancer.com\/blog\/how-to-send-attachment-files-to-email-using-laravel-upload-document-and-send-mail-in-laravel\/","og_site_name":"DevOps Freelancer","article_author":"https:\/\/www.facebook.com\/amitsthakurs\/","article_published_time":"2024-02-20T11:50:05+00:00","article_modified_time":"2024-02-29T11:59:06+00:00","og_image":[{"url":"https:\/\/www.devopsfreelancer.com\/blog\/wp-content\/uploads\/2024\/02\/image-129.png","type":"","width":"","height":""}],"author":"Amit Kumar","twitter_card":"summary_large_image","twitter_creator":"@https:\/\/twitter.com\/amits_thakurs","twitter_misc":{"Written by":"Amit Kumar","Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.devopsfreelancer.com\/blog\/how-to-send-attachment-files-to-email-using-laravel-upload-document-and-send-mail-in-laravel\/#article","isPartOf":{"@id":"https:\/\/www.devopsfreelancer.com\/blog\/how-to-send-attachment-files-to-email-using-laravel-upload-document-and-send-mail-in-laravel\/"},"author":{"name":"Amit Kumar","@id":"https:\/\/www.devopsfreelancer.com\/blog\/#\/schema\/person\/22ed4bd82dc04200a2ca541b3e35fc5b"},"headline":"How to send attachment files to email using laravel | Upload Document and send Mail in Laravel","datePublished":"2024-02-20T11:50:05+00:00","dateModified":"2024-02-29T11:59:06+00:00","mainEntityOfPage":{"@id":"https:\/\/www.devopsfreelancer.com\/blog\/how-to-send-attachment-files-to-email-using-laravel-upload-document-and-send-mail-in-laravel\/"},"wordCount":242,"commentCount":0,"image":{"@id":"https:\/\/www.devopsfreelancer.com\/blog\/how-to-send-attachment-files-to-email-using-laravel-upload-document-and-send-mail-in-laravel\/#primaryimage"},"thumbnailUrl":"https:\/\/www.devopsfreelancer.com\/blog\/wp-content\/uploads\/2024\/02\/image-129.png","keywords":["image-upload-in-laravel","laravel","laravel-image-upload","mail-send-in-laravel"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.devopsfreelancer.com\/blog\/how-to-send-attachment-files-to-email-using-laravel-upload-document-and-send-mail-in-laravel\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.devopsfreelancer.com\/blog\/how-to-send-attachment-files-to-email-using-laravel-upload-document-and-send-mail-in-laravel\/","url":"https:\/\/www.devopsfreelancer.com\/blog\/how-to-send-attachment-files-to-email-using-laravel-upload-document-and-send-mail-in-laravel\/","name":"How to send attachment files to email using laravel | Upload Document and send Mail in Laravel - DevOps Freelancer","isPartOf":{"@id":"https:\/\/www.devopsfreelancer.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.devopsfreelancer.com\/blog\/how-to-send-attachment-files-to-email-using-laravel-upload-document-and-send-mail-in-laravel\/#primaryimage"},"image":{"@id":"https:\/\/www.devopsfreelancer.com\/blog\/how-to-send-attachment-files-to-email-using-laravel-upload-document-and-send-mail-in-laravel\/#primaryimage"},"thumbnailUrl":"https:\/\/www.devopsfreelancer.com\/blog\/wp-content\/uploads\/2024\/02\/image-129.png","datePublished":"2024-02-20T11:50:05+00:00","dateModified":"2024-02-29T11:59:06+00:00","author":{"@id":"https:\/\/www.devopsfreelancer.com\/blog\/#\/schema\/person\/22ed4bd82dc04200a2ca541b3e35fc5b"},"breadcrumb":{"@id":"https:\/\/www.devopsfreelancer.com\/blog\/how-to-send-attachment-files-to-email-using-laravel-upload-document-and-send-mail-in-laravel\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.devopsfreelancer.com\/blog\/how-to-send-attachment-files-to-email-using-laravel-upload-document-and-send-mail-in-laravel\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.devopsfreelancer.com\/blog\/how-to-send-attachment-files-to-email-using-laravel-upload-document-and-send-mail-in-laravel\/#primaryimage","url":"https:\/\/www.devopsfreelancer.com\/blog\/wp-content\/uploads\/2024\/02\/image-129.png","contentUrl":"https:\/\/www.devopsfreelancer.com\/blog\/wp-content\/uploads\/2024\/02\/image-129.png","width":600,"height":315},{"@type":"BreadcrumbList","@id":"https:\/\/www.devopsfreelancer.com\/blog\/how-to-send-attachment-files-to-email-using-laravel-upload-document-and-send-mail-in-laravel\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.devopsfreelancer.com\/blog\/"},{"@type":"ListItem","position":2,"name":"How to send attachment files to email using laravel | Upload Document and send Mail in Laravel"}]},{"@type":"WebSite","@id":"https:\/\/www.devopsfreelancer.com\/blog\/#website","url":"https:\/\/www.devopsfreelancer.com\/blog\/","name":"DevOps Freelancer","description":"We provide DevOps | SRE | DevSecOps | MLOps Freelancing","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.devopsfreelancer.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/www.devopsfreelancer.com\/blog\/#\/schema\/person\/22ed4bd82dc04200a2ca541b3e35fc5b","name":"Amit Kumar","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/d76fb4d0f15f7a458f1fd91063b44fbb7e7eb9e724b1c465d885054c2540250f?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/d76fb4d0f15f7a458f1fd91063b44fbb7e7eb9e724b1c465d885054c2540250f?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/d76fb4d0f15f7a458f1fd91063b44fbb7e7eb9e724b1c465d885054c2540250f?s=96&d=mm&r=g","caption":"Amit Kumar"},"description":"Hi I am Amit Kumar Thakur Experienced as s Software Developer with a demonstrated history of working in the information technology and services industry. Skilled in HTML, CSS, Bootstrap4, PHP, Laravel-9 , REST API,FB API,Google API, Youtube Api, Bitbucket,Github,Linux and jQuery. Strong engineering professional focused in Computer\/Information Technology Administration and Management. Currently my profile is to Software Developer, analyze the requirement, creating frame for web application, coding and maintenance.","sameAs":["https:\/\/www.facebook.com\/amitsthakurs\/","https:\/\/www.instagram.com\/amits_thakurs\/","https:\/\/www.linkedin.com\/in\/amits-thakurs\/","https:\/\/x.com\/https:\/\/twitter.com\/amits_thakurs"],"url":"https:\/\/www.devopsfreelancer.com\/blog\/author\/amit\/"}]}},"_links":{"self":[{"href":"https:\/\/www.devopsfreelancer.com\/blog\/wp-json\/wp\/v2\/posts\/1855","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.devopsfreelancer.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.devopsfreelancer.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.devopsfreelancer.com\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.devopsfreelancer.com\/blog\/wp-json\/wp\/v2\/comments?post=1855"}],"version-history":[{"count":1,"href":"https:\/\/www.devopsfreelancer.com\/blog\/wp-json\/wp\/v2\/posts\/1855\/revisions"}],"predecessor-version":[{"id":1864,"href":"https:\/\/www.devopsfreelancer.com\/blog\/wp-json\/wp\/v2\/posts\/1855\/revisions\/1864"}],"wp:attachment":[{"href":"https:\/\/www.devopsfreelancer.com\/blog\/wp-json\/wp\/v2\/media?parent=1855"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.devopsfreelancer.com\/blog\/wp-json\/wp\/v2\/categories?post=1855"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.devopsfreelancer.com\/blog\/wp-json\/wp\/v2\/tags?post=1855"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}