Skip to content

Instantly share code, notes, and snippets.

@astrophysik928
Last active November 8, 2018 05:12
Show Gist options
  • Save astrophysik928/8a03f5a5a01f6f8bd8f61373332f1836 to your computer and use it in GitHub Desktop.
Save astrophysik928/8a03f5a5a01f6f8bd8f61373332f1836 to your computer and use it in GitHub Desktop.
Gmailを用いてフォームから質問文を送信
<!DOCTYPE html>
<html lang="ja">
<head>
<meta charset="utf-8">
<title>Question Form</title>
<style>
h2 {
background-color: bisque;
}
ol {
background-color: beige;
}
</style>
</head>
<body bgcolor="lightgreen">
<h2>Question Form</h2>
<h3></h3>
<form name=questionForm method="post" enctype="text/plain">
<P>Write your question</P>
<textarea name="question" cols="50" rows="2" style="width:500px;height:200px;"></textarea>
<br>
<button id="send_Mail">Send</button>
</form>
<script type="text/javascript" src="jquery.js"></script>
<script src="https://smtpjs.com/v2/smtp.js"></script>
<script type="text/javascript">
function sendMail(your_text) {
Email.send(
"1234@gmail.com",
"ABCD@gmail.com",
"The question to you!!",
your_text,
"imap.gmail.com",
"1234",
"aaa"
);
}
var btn = document.getElementById('send_Mail');
btn.addEventListener('click', function () {
sendMail(document.questionForm.question.value);
alert("Sending text is finished!");
})
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment