Search code examples
vue.jssmtp

is it possible for the src of a script to be import?


I'm trying to use smtp.js to send email however in it's documentation

in order to use it. it has to include the script

<script src="https://smtpjs.com/v3/smtp.js">
</script>

and I'm using setup() in vue.js

export default {
setup (){
  return {
}
}
};

can I just import the script source? like this

import "https://smtpjs.com/v3/smtp.js";

Solution

  • just found out the answer

    need to click the link

    and in browser this will show

    var Email = { send: function (a) { return new Promise(function (n, e)
     { a.nocache = Math.floor(1e6 * Math.random() + 1), a.Action = "Send"; var t = JSON.stringify(a);
     Email.ajaxPost("https://smtpjs.com/v3/smtpjs.aspx?", t, function (e) { n(e) }) }) }, ajaxPost: function (e, n, t)
      { var a = Email.createCORSRequest("POST", e); a.setRequestHeader("Content-type", "application/x-www-form-urlencoded"), a.onload = function () { var e = a.responseText;
    

    so i just put it in the script

              <script>
        export default {
        setup() {
    
        i put it here
    and add it to a function
        return{
        }
        }}
        </script>