Email | SMTP Server Host | SMTP Server Port | SMTP Security Mode |
QQ Mail | smtp.qq.com | 465/578 | SSL(465)/STARTSSL(587) |
Tencent Exmail | smtp.exmail.qq.com | 465 | SSL |
163 Mail | smtp.163.com | 465 | SSL |
gmail | smtp.gmail.com | 465/578 | SSL(465)/STARTSSL(587) |
import cloudbase from "@cloudbase/js-sdk";const app = cloudbase.init({env: "your-env-id"});
// Assume the user enters the email test@example.comconst email = "test@example.com";const verification = await auth.getVerification({email: email});
// Assume the user enters the Captcha 000000.const verificationCode = "000000";// Verify the correctness of the Captcha.const verificationTokenRes = await auth.verify({verification_id: verification.verification_id,verification_code: verificationCode});
// If the user already exists, log in.if (verification.is_user) {await auth.signIn({username: email,verification_token: verificationTokenRes.verification_token});} else {// Otherwise, register a new user and set a password and username.// Remark: Upon successful signUp, the user will be automatically logged in.await auth.signUp({email: email,verification_code: verificationCode,verification_token: verificationTokenRes.verification_token,// Optional, set username.username: "userFromEmail",// Optional, set password.password: "password123"});}
Feedback