How to realize the function of sending email by js
This article mainly shows you "js how to achieve email function", the content is easy to understand, clear, hope to help you solve your doubts, the following let the editor lead you to study and learn "js how to achieve email function" this article.
Js email mode
Method 1: use the href attribute of the a tag
Sendmail
In this way, the client is required to install mail client software, such as Foxmail,Outlook,YoMail, and mailto is equivalent to calling the local mail client to send mail. Remember that users who need to configure mailboxes manually match POP3 and SMTP!
Method 2: use location in js
Location= "= theme & body= content"
In the same way, you need to install the mail client software, but call it in js instead.
Method 3: use nodemail in node
You first need to install the environment for node, and then install nodemailer:
Npminstallnodemailer--save
Npminstallnodemailer-smtp-transport--save
Configuration under config.js:
Module.exports= {
Email: {/ / Mail configuration
Service:' email address'
User:' your email address.
Pass:' your password.
}
}
Call method:
SendMail (this is the test email', 'this is the content')
Js uses node's emailjs to send email
For an environment that requires node, install emailjs, as follows:
Npminstallemailjs
Since the SMTP service of email is disabled by default, if we want to send it, we have to enable it first, and then the key point comes. When it is enabled, an authorization code will be generated, which needs to be copied and saved.
The above is all the contents of the article "how to send email in js". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!