PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Monday, November 14, 2022

[FIXED] How to send localstorage data to email in javascript

 November 14, 2022     email-validation, error-handling, javascript, javascript-objects, node.js     No comments   

Issue

I want to send client response to admin email account. So I want to use Javascript.

(e, t) => {
  const o = {
    msg: e,
    display_name: 'Customer Support',
    nick: 'agent:chatbot',
    timestamp: Date.now(),
    options: t ? ['paymentLink'] : void 0,
  };
  let messages = JSON.parse(window.localStorage.getItem('messages')) || []
  messages.push(o)
  window.localStorage.setItem('messages', JSON.stringify(messages))
  messages = JSON.parse(window.localStorage.getItem('messages'))

  if (messages.length === 3) {

    window.localStorage.setItem('messages', JSON.stringify([]))
    document.getElementById("hidden-form").submit()
  }

  if (document.querySelector('#mes2').value || document.querySelector('#mes2').value.length > 0) {
    document.querySelector('#mes2').value = document.querySelector('#mes2').value + ',' + JSON.stringify(o)
  } else {
    document.querySelector('#mes2').value = JSON.stringify(o)

  }
  C([...j, o]);
},

Here is how I want to call the function, But I'm not sure what to put into the javascript function. From the research I've done I found that I can use EmailJs or mailto method.


Solution

you can use sendgrid, it's very simple.

sendgrid.com



Answered By - Daniel
Answer Checked By - Dawn Plyler (PHPFixing Volunteer)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

1,205,819

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © 2025 PHPFixing