smtpjs attachment
<html>
<script src="https://smtpjs.com/v3/smtp.js"></script>
<input type="file" id="fileupload" onchange="uploadFileToServer()" />
<script>
function uploadFileToServer()
{
var file = event.srcElement.files[0];
var reader = new FileReader();
reader.readAsBinaryString(file);
reader.onload = function () {
var dataUri = "data:" + file.type + ";base64," + btoa(reader.result);
Email.send({
SecureToken : "********",
To : '[email protected]',
From : "[email protected]",
Subject : "Send with base64 attachment",
Body : "Sending file:" + file.name,
Attachments : [
{
name : file.name,
data : dataUri
}]
}).then(
message => alert(message)
);
};
reader.onerror = function() {
console.log('there are some problems');
};
}
</script>
</html>
Also in JavaScript:
- vue js cdn
- get last item in array javascript
- Image react native
- javascript add days to date
- use effect react
- javascript includes
- loop in object javascript
- user input through js
- js extract only numbers from string
- how to set background colour i js inline stylel
- javascript substring
- javascript var in quotes
- how to change package name in react native
- for each array javascript
- add property to object javascript
- javascript object entries
- javascript replace p tags with new line
- react class and props example
- js remove the last character of a string
- join two arrays javascript
- create function javascript
- bootstrap in javascript
- remove letter js
- js datetime format