data = $data; $this->attachment = $attachment_list; } /** * Build the message. * * @return $this */ public function build() { $mail = $this->from(get_static_option('site_global_email'), get_static_option('site_'.get_default_language().'_title')) ->subject('You Have Contact Mail') ->view('mail.get-touch'); if (!empty($this->attachment)){ foreach ($this->attachment as $field_name => $attached_file){ if (file_exists($attached_file)){ $mail->attach($attached_file); } } } return $mail; } }