[英]how can anyone send email to me on my website in js
I am creating a project as I have created a contact page.我正在创建一个项目,因为我已经创建了一个联系页面。 I want any user to send me a email by putting his email and message in input box of contact page.
我希望任何用户通过在联系页面的输入框中输入他的 email 和消息来向我发送 email。 I have also tried smtpjs but with that I can send the email from my side and registered email on smtpjs but unknown user who put his email without putting his password can't send email to me
我也尝试过 smtpjs 但这样我可以从我这边发送 email 并在 smtpjs 上注册 email 但是未知用户在没有输入密码的情况下输入 email 无法发送 email 给我
for eg-例如-
my email - myemail@gmail.com我的 email - myemail@gmail.com
my password - mypassword我的密码-我的密码
unknown user email - unknown@gmail.com未知用户 email - unknown@gmail.com
how can unknown user send me email by putting only his email on my website contact page未知用户如何通过仅将他的 email 放在我的网站联系页面上来向我发送 email
any js library and js code can use for this problem please tell me任何 js 库和 js 代码都可以用于这个问题请告诉我
You should try emailjs .你应该试试emailjs 。 Just follow the docs here.
只需按照此处的文档操作即可。
1 Include SMTP in your <script></script> tag :
<script src="https://smtpjs.com/v3/smtp.js"></script>
2 Include the script for use your send email button
<script type="text/javascript">
function sendEmail() {
Email.send({
Host: "smtp.gmail.com",
Username: "sender@email_address.com",
Password: "Enter your password",
To: 'receiver@email_address.com',
From: "sender@email_address.com",
Subject: "Sending Email using javascript",
Body: "Well that was easy!!",
})
.then(function (message) {
alert("mail sent successfully")
});
}
</script>
3.Use that function in your Html button
<input type="button" value="Send Email"
onclick="sendEmail()" />
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.