Created
July 5, 2017 18:07
-
-
Save kurai021/77d0eaafb7cc6886452473cbec0d8fee to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function sendmail(){ | |
var name = document.getElementById("name").value; | |
var lastname = document.getElementById("lastname").value; | |
var email = document.getElementById("email").value; | |
var phone = document.getElementById("phone").value; | |
var country = document.getElementById("country").value; | |
var project = document.getElementById("project").value; | |
var contact = "Email"; | |
var comment = document.getElementById("comments").value; | |
$.ajax({ | |
url: "https://api.sendgrid.com/v3/mail/send.json", | |
type: 'POST', | |
beforeSend: function(request, settings) { | |
request.setRequestHeader("Authorization", 'bearer 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'); | |
}, | |
data: { | |
"personalizations": [{ | |
"to": [{ | |
"email": "[email protected]" | |
}] | |
}], | |
"from": { | |
"email": email | |
}, | |
"subject": "Contacto", | |
"content": [{ | |
"type": "text/plain", | |
"value": "<p>Nombre: " + name + " " + lastname + "</br>" + "Teléfono: " + phone + "</br>" + "País: " + country + "</br>" + "Proyecto de interés: " + project + "</br>" + comment + "</p>" | |
}] | |
} | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment