Skip to content Skip to sidebar Skip to footer

Sending Email From Javascript With Smtp Server

I'm trying to send an Email within my JavaScript automatically if an if statement turns into an else. I have an SMTP-Server, but I really dont know how to implement that. Already t

Solution 1:

You can use this tool:

https://www.smtpjs.com/

It allows you to encrypt your SMTP credentials when you call it so you don't expose them to the client side.

Include this script:

<scriptsrc="https://smtpjs.com/v2/smtp.js"></script>

And then you can call the service like this:

Email.send("from@you.com",
    "to@them.com",
    "This is a subject",
    "this is the body",
    "smtp.yourisp.com",
    "username",
    "password"
);

If you don't want to expose your credentials you can generate a secure token using the website I linked above.

Email.send("from@you.com",
    "to@them.com",
    "This is a subject",
    "this is the body",
    {token: "63cb3a19-2684-44fa-b76f-debf422d8b00"}
);

And call it like this.

Post a Comment for "Sending Email From Javascript With Smtp Server"