Skip to content
Snippets Groups Projects
feedback.md 935 B
Newer Older
  • Learn to ignore specific revisions
  • # Feedback
    
    Users can send a feedback in the application, the feedback's receiver is defined in the _FeedbackModal component_
    
    ## Add mail attachments
    
    The user has the possibility to add an image to a feedback.
    
    The email informations are created in the _sendEmail_ function and the mailData respects this scheme :
    
    ```js
    const mailData = {
      mode: "from",
      to: [{ name: "Support", email: "receiver-email" }],
      subject: "Your subject",
      parts: [{ type: "text/plain", body: mailContent }],
      attachments: [{ filename: "test.png", content: "base64file" }],
    };
    ```
    
    It is important that your file is sent base64 encoded to the sendmail job and with the _data...base64_ headers removed, otherwise it will be unreadable.
    In order to do this, we use a reader to read the file as Data URL
    
    ```js
    reader.readAsDataURL(file);
    ```
    
    and then apply to the result so we send only the encoded part without its headers.
    
    ```js
    split(",")[1];
    ```