简体   繁体   English

谁能用 js 在我的网站上向我发送 email

[英]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.

相关问题 如何在我的 Wix 网站上发送带有 PDF 文件的 email - How can I send email with PDF file on my Wix website 谁能告诉我这些黑客试图在我的网站上做什么? - Can anyone tell me what these hackers are attempting to do on my website? 谁能向我解释如何在此网站上添加其他发布参数? - Can anyone explain to me how additional post params are added on this website? 任何人都可以帮助我如何根据时间对 div 进行排序吗? js - Can anyone help me on how to sort div according to time? js 谁能帮助我了解如何将我的 html 表格居中? - Can anyone help me understand how to center my html table? 嘿,谁能帮我在我的网站上初始化 commentbox.io 代码? - Hey, can anyone help me initialize commentbox.io code in my weebly website? 如何使我的联系表发送给我电子邮件 - How to make my contact form send me Email 谁能帮我把它变成 js 语法? - can anyone help me to turn this to js syntax? 谁能告诉我如何获得 Oculus Connect 3 网站中使用的背景动画效果? - Can anyone tell me how to get the background animation effect used in Oculus Connect 3 website? 谁能解释为什么我的date函数通过JS date对象给我一个错误的转换? - Can anyone explain why my date function is giving me a wrong conversion via JS date object?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM