Index: /controller/wpsg_AdminController.class.php
===================================================================
--- /controller/wpsg_AdminController.class.php	(revision 7155)
+++ /controller/wpsg_AdminController.class.php	(revision 7156)
@@ -1618,4 +1618,53 @@
 		{
 
+		    if (isset($_REQUEST['migrateAttachmentToMediathek'])) {
+		        
+		        switch ($_REQUEST['migrateAttachmentToMediathek']) {
+		         
+                    case '1': $file = wpsg_getUploadDir('wpsg_mailconf').$this->shop->get_option('wpsg_kundenmail_attachfile'); break;
+                    
+                    default: throw new \Exception(__('Nicht definiert.', 'wpsg'));
+                    
+                }
+                
+                if (file_exists($file) && is_file($file)) {
+
+                    $filetype = wp_check_filetype(basename($file), null);
+                    $wp_upload_dir = wp_upload_dir();
+
+                    $attachment = array(
+                        'guid' => $wp_upload_dir['url'].'/'.basename($file),
+                        'post_mime_type' => $filetype['type'],
+                        'post_title' => preg_replace('/\.[^.]+$/', '', basename($file)),
+                        'post_content' => '',
+                        'post_status' => 'inherit'
+                    );
+
+                    $attach_id = wp_insert_attachment($attachment, $file, $parent_post_id);
+                    
+                    switch ($_REQUEST['migrateAttachmentToMediathek']) {
+                        
+                        case '1': 
+                            
+                            $arAttachment = explode(',', $this->shop->get_option('wpsg_kundenmail_mediaattachment')); 
+                            $arAttachment[] = $attach_id; 
+                        
+                            $this->shop->update_option('wpsg_kundenmail_mediaattachment', implode(',', wpsg_trim($arAttachment))); 
+                            $this->shop->update_option('wpsg_kundenmail_attachfile', false);
+                            
+                            break;
+                                                    
+                    }
+                    
+                    $this->shop->addBackendMessage(__('Anhang erfolgreich konvertiert.', 'wpsg'));
+                    
+                    @unlink($file);
+		            
+                } else $this->addBackendError(__('Anhang konnte nicht gefunden werden.', 'wpsg'));
+
+                $this->redirect(WPSG_URL_WP.'wp-admin/admin.php?page=wpsg-Admin&action=ueber&subaction=systemcheck');
+		        
+            }
+		    
 		    if (isset($_REQUEST['getEmailLogo'])) {
 
@@ -2021,6 +2070,5 @@
 
 			}
-			else if (@$_REQUEST['subaction'] == "dataprotection")
-			{
+			else if (@$_REQUEST['subaction'] == "dataprotection") {
 
 				$this->update_option('dataprotectioncommissioner', $_REQUEST['dataprotectioncommissioner']);
Index: /controller/wpsg_ShopController.class.php
===================================================================
--- /controller/wpsg_ShopController.class.php	(revision 7155)
+++ /controller/wpsg_ShopController.class.php	(revision 7156)
@@ -801,4 +801,5 @@
 
 				wp_enqueue_script('wpsg_bsjs', $this->getRessourceURL('js/bootstrap-3.3.6-dist/js/bootstrap.min.js'));
+                wp_enqueue_script('wpsg_vuejs', $this->getRessourceURL('js/vue.min.js'));
 
 				wp_enqueue_script('common');
@@ -1247,4 +1248,5 @@
                 // Anfrageliste
                 if ($this->hasMod('wpsg_mod_request')) {
+                    
                 	$page_id = $this->get_option('wpsg_page_request');
                 	
@@ -1256,4 +1258,20 @@
                 	
                 }
+                
+                // Anhang an Kundenmail
+                $old_attachment = $this->get_option('wpsg_kundenmail_attachfile');
+                if (wpsg_isSizedString($old_attachment) && file_exists(wpsg_getUploadDir('wpsg_mailconf').$old_attachment)) {
+                    
+                    $arData[] = [
+                        'general_customermail_attachment',
+                        self::CHECK_ERROR,
+                        wpsg_translate(__('Es gibt noch einen alten Anhang der Kundenmail auÃerhalb der Mediathek, dieser muss in die Mediathek ÃŒberfÃŒhrt oder neu angegeben werden. <a href="#1#">Automatisiert ÃŒbernehmen</a> / <a href="#2#">E-Mail Konfiguration</a>', 'wpsg'),
+                            WPSG_URL_WP.'wp-admin/admin.php?page=wpsg-Admin&subaction=emailconf&migrateAttachmentToMediathek=1&noheader=1',
+                            WPSG_URL_WP.'wp-admin/admin.php?page=wpsg-Admin&subaction=emailconf'
+                        )
+                    ];
+                    
+                }
+                
                 
                 // Warenkorbseite
@@ -3198,4 +3216,24 @@
 			}
 
+			// AnhÃ€nge aus der Mediathek anfÃŒgen
+            $arAttachmentSet = $this->getMailValue('wpsg_'.$mail_key.'_mediaattachment');
+
+            if (wpsg_isSizedString($arAttachmentSet)) {
+
+                $arAttachmentSet = explode(',', $arAttachmentSet);
+
+                foreach ($arAttachmentSet as $a_id) {
+
+                    $a_file = get_attached_file($a_id);
+                    
+                    if (file_exists($a_file)) {
+                        
+                        $anhang[] = $a_file;
+                        
+                    }
+                    
+                }
+            }
+			
 			$this->callMods('sendMail', array($mail_key, $o_id, $k_id, &$empfaenger, &$subject, &$mail_text_send, &$headers, &$anhang));
 
@@ -3679,8 +3717,4 @@
 			}
 
-			// Kundenmailanhang prÃŒfen
-			if (wpsg_isSizedString($this->get_option('wpsg_kundenmail_attachfile')) && !file_exists(wpsg_getUploadDir('wpsg_mailconf').$this->get_option('wpsg_kundenmail_attachfile')))
-				$this->addBackendError('nohspc_'.wpsg_translate(__('Es ist ein Anhang der Kundenmail definiert, die Datei wurde aber nicht gefunden. <a href="#1#">Zur E-Mail Konfiguration</a>', 'wpsg'), WPSG_URL_WP.'wp-admin/admin.php?page=wpsg-Admin&subaction=emailconf'));
-
 			$this->callMods('checkGeneralBackendError');
 
Index: /lib/helper_functions.inc.php
===================================================================
--- /lib/helper_functions.inc.php	(revision 7155)
+++ /lib/helper_functions.inc.php	(revision 7156)
@@ -303,4 +303,11 @@
 		}
 		
+		// AnhÃ€nge aus Mediathek speichern
+		if (isset($_REQUEST['wpsg_'.$key.'_mediaattachment'])) {
+		    
+		    $GLOBALS['wpsg_sc']->update_option('wpsg_'.$key.'_mediaattachment', $_REQUEST['wpsg_'.$key.'_mediaattachment']);
+		    
+        }
+				
 	} // function wpsg_saveEMailConfig($key)
 	
Index: /lib/wpsg_basket.class.php
===================================================================
--- /lib/wpsg_basket.class.php	(revision 7155)
+++ /lib/wpsg_basket.class.php	(revision 7156)
@@ -580,12 +580,5 @@
 
 				$arAttachments = array();
-
-				if (wpsg_isSizedString($this->shop->get_option('wpsg_kundenmail_attachfile')) && file_exists(wpsg_getUploadDir('wpsg_mailconf').$this->shop->get_option('wpsg_kundenmail_attachfile')))
-				{
-
-					$arAttachments[] = wpsg_getUploadDir('wpsg_mailconf').$this->shop->get_option('wpsg_kundenmail_attachfile');
-
-				}
-
+				 
 				if ($this->shop->get_option('wpsg_widerrufsformular_kundenmail') === '1' && wpsg_isSizedString($this->shop->get_option('wpsg_revocationform')))
 				{
Index: /views/admin/emailconf.phtml
===================================================================
--- /views/admin/emailconf.phtml	(revision 7155)
+++ /views/admin/emailconf.phtml	(revision 7156)
@@ -16,4 +16,10 @@
 
 </div>
+
+<script>
+
+    var uploadData = {};
+    
+</script>
 
 <div class="wpsg_admin_content form-horizontal">
@@ -155,7 +161,83 @@
 
 	} // function wpsg_mail_save_cookie()
-
+    
+    function wpsg_removeAttachemnt(a) {
+	     
+	    var id = parseInt(a.getAttribute('data-id'));
+	    var key = a.getAttribute('data-key');
+ 
+        uploadData[key].forEach(function(item, index, object) {
+
+            if (parseInt(item.id) === id) {
+ 
+                object.splice(index, 1);
+                
+            }
+            
+        } ); 
+                
+        return false;
+	    
+    }
+    
+    var wpframe;
+	
 	jQuery(document).ready(function() {
-
+	    
+        jQuery(".btnAddAttachment").click(function(event) {
+
+            var source = event.target || event.srcElement;
+            var key = jQuery(source).attr("data-key");
+            
+            event.preventDefault();
+
+            if (wpframe) { wpframe.open(); return; }
+ 
+            wpframe = wp.media.frames.file_frame = wp.media({
+                title: "<?php echo __('AuswÃ€hlen oder Hochladen von Medien', 'wpsg'); ?>",
+                button: { text: "<?php echo __('Medien benutzen', 'wpsg'); ?>" },
+                multiple: true  
+            });
+ 
+            wpframe.on('select', function() {
+
+                var attachments = wpframe.state().get('selection').map( function(attachment) {
+
+                    attachment.toJSON();
+ 
+                    var bDrin = false;
+                
+                    for (var i in uploadData[key]) {
+                        
+                        if (uploadData[key][i].id === attachment.id) {
+                            
+                            bDrin = true;
+                            
+                            break;
+                            
+                        }
+                        
+                    }
+                    
+                    if (!bDrin) {
+                    
+                        uploadData[key].push( {
+                            id: attachment.id, 
+                            filename: attachment.attributes.filename,
+                            url: attachment.attributes.url
+                        } );
+                        
+                    }
+                    
+                    return attachment;
+                    
+                } ); 
+                
+            } );
+ 
+            wpframe.open();
+
+        } );
+	    
 		jQuery('.wpsg_email_box .panel-heading').bind('click', function() {
 
Index: /views/admin/form/emailconf.phtml
===================================================================
--- /views/admin/form/emailconf.phtml	(revision 7155)
+++ /views/admin/form/emailconf.phtml	(revision 7156)
@@ -12,17 +12,37 @@
 	<?php echo wpsg_drawForm_Input('wpsg_'.$this->view['field_key'].'_bcc', __('BCC', 'wpsg'), $this->get_option('wpsg_'.$this->view['field_key'].'_bcc')); ?>	
 	
-	<?php if ($this->view['field_attachment'] === true) { ?>
-		
-		<?php echo wpsg_drawForm_Upload('wpsg_'.$this->view['field_key'].'_attachfile', __('Mailanhang', 'wpsg'), '', '43', '100000'); ?>
-		<br />
-		<div class="wpsg_hinweis">
-			<strong><?php echo __('Aktueller Anhang', 'wpsg') ?>: </strong><?php echo ((wpsg_isSizedString($this->get_option('wpsg_'.$this->view['field_key'].'_attachfile')))?$this->get_option('wpsg_'.$this->view['field_key'].'_attachfile'):__('keiner', 'wpsg')); ?>
-			<?php echo ((wpsg_isSizedString($this->get_option('wpsg_kundenmail_attachfile')))?'<a class="wpsg_glyphicon_right glyphicon glyphicon-minus-sign" titel="'.__('Datei entfernen', 'wpsg').'" href="'.WPSG_URL_WP.'wp-admin/admin.php?page=wpsg-Admin&amp;subaction='.$_REQUEST['subaction'].'&amp;cmd=del_attach_file"></a>':''); ?>
-		</div>
-		<br />
-		
-	<?php } ?>
+    <div class="form-group form-group-sm">
+    
+        <label class="col-sm-6 control-label">
 
-    <br /><p style="font-weight:700;"><?php echo (__('Text unter der E-Mail', 'wpsg')); ?></p>
+            <input value="<?php echo __('Neuer Anhang', 'wpsg'); ?>" data-key="<?php echo $this->view['field_key']; ?>" class="btnAddAttachment button" type="text" style="text-align:center;" size="10" id="media_<?php echo $this->view['field_key']; ?>" />
+            
+        </label>
+    
+        <div class="col-sm-6">
+    
+            <div class="wpsg_mailattachment" id="wpsg_mailattachment_<?php echo $this->view['field_key']; ?>">
+                <div v-for="a in arAttachment">
+                    
+                    <div class="wpsg_flex wpsg_flex_justify_content_space_between wpsg_flex_align_items_center">
+                        <a target="_blank" v-bind:href="a.url">{{a.filename}}</a>
+                        <a href="" v-bind:data-id="a.id" data-key="<?php echo $this->view['field_key']; ?>" onclick="return wpsg_removeAttachemnt(this);">
+                            <span class="fa fa-trash"></span>
+                        </a>                        
+                    </div>
+                                         
+                </div>
+                <input type="hidden" v-bind:value="getIds" name="wpsg_<?php echo $this->view['field_key']; ?>_mediaattachment" />
+            </div>
+    
+        </div>
+    
+        <div class="clearfix wpsg_clear"></div>
+    
+    </div>
+
+    <hr />
+
+    <p style="font-weight:700;"><?php echo (__('Text unter der E-Mail', 'wpsg')); ?></p>
 
     <?php
@@ -48,4 +68,58 @@
 	
 	<br />
+
+    <script>
+
+        uploadData['<?php echo $this->view['field_key']; ?>'] = <?php
+                
+            $arAttachment = [];
+            $arAttachmentSet = $this->get_option('wpsg_'.$this->view['field_key'].'_mediaattachment');
+            
+            if (wpsg_isSizedString($arAttachmentSet)) {
+                
+                $arAttachmentSet = explode(',', $arAttachmentSet);
+                
+                foreach ($arAttachmentSet as $a_id) {
+                
+                    $a_file = get_attached_file($a_id);
+                    $a_url = wp_get_attachment_url($a_id);
+                        
+                    $arAttachment[] = [
+                        'id' => $a_id,
+                        'filename' => basename($a_file),
+                        'url' => $a_url
+                    ];
+                    
+                }
+                
+            }
+                
+            echo json_encode($arAttachment);
+                
+        ?>;
+
+        var wpsg_mailattachment_<?php echo $this->view['field_key']; ?> = new Vue( {
+            el: '#wpsg_mailattachment_<?php echo $this->view['field_key']; ?>',
+            data: {
+                arAttachment: uploadData.<?php echo $this->view['field_key']; ?>        
+            },
+            computed: {
+                getIds: function() {
+                    
+                    var arReturn = [];
+                    
+                    for (var i in this.arAttachment) {
+                     
+                        arReturn.push(this.arAttachment[i].id); 
+                        
+                    }
+                    
+                    return arReturn;
+                    
+                }
+            }
+        } );
+        
+    </script>
 		
 <?php echo wpsg_drawForm_AdminboxEnd(); ?>
Index: /views/css/admin.css
===================================================================
--- /views/css/admin.css	(revision 7155)
+++ /views/css/admin.css	(revision 7156)
@@ -4,4 +4,7 @@
 /* Allgemein */
 .wpsg_clear { clear:both; }
+.wpsg_flex { display:flex; width:100%; }
+.wpsg_flex_justify_content_space_between { justify-content:space-between; }
+.wpsg_flex_align_items_center { align-items:center; }
 
 /* Bootstrap Teil */
@@ -179,4 +182,6 @@
 .email-logo { padding-bottom: 10px; }
 .email-logo-watermark { position:absolute; top:10%; left:0; right:0; display:flex; justify-content:center; align-items:center; }
+.wpsg_mailattachment { padding:8px 0px; }
+.wpsg_mailattachment a { display:block; min-height:24px; line-height:24px; }
 
 /* Produktverwaltung */
