Kirim Email Otomatis dengan Bot WhatsApp - Fitur Owner
//nScript By Reelly XD/n • YT: ReellyXD/n • IG: reellyxd/nBuy Script? /n • WA: +62 857-0436-85323/n • TELE: t.me/rely_xd/n • Github: github.com/ReellyXD/n//n/nimport nodemailer from 'nodemailer';/nimport config from '../config.json';/n/nconst handler = async function(m, { text, usedPrefix }) {/n if (!text) throw *Example*: ${usedPrefix}email zykn@gmail.com | Bayar utang lu.;/n const email = text.trim().split(//s+/|/s+/).shift();/n const message = text.trim().split(//s+/|/s+/).pop();/n if (!isValidEmail(email)) throw 'format email salah';/n const transporter = nodemailer.createTransport({/n service: 'gmail',/n auth: {/n user: config.email,/n pass: config.password/n }/n });/n const mailOptions = {/n from: config.email,/n to: email,/n subject: config.email_subject,/n html: /n <div style='border: 1px solid #ccc; padding: 20px; font-family: monospace;'>/n <p style='font-size: 16px; margin-bottom: 20px;'>${message}</p>/n <div style='text-align: center; font-family: monospace;'>/n <hr style='display: inline-block; margin-top: 20px; margin-bottom: 20px; width: 60%;'>/n <p style='font-size: 12px; display: inline-block;'>Config By Reelly</p>/n </div>/n </div>/n /n };/n try {/n await transporter.sendMail(mailOptions);/n m.reply('Email telah terkirim!');/n } catch (e) {/n console.log(e);/n m.reply('Gagal mengirim email. Silakan coba lagi nanti');/n }/n};/n/nhandler.help = ['email'];/nhandler.tags = ['owner'];/nhandler.owner = true;/nhandler.command = /^(email|mail)$/i;/n/nexport default handler;/n/nfunction isValidEmail(email) {/n const emailRegex = /^[^/s@]+@[^/s@]+/.[^/s@]+$/;/n return emailRegex.test(email);/n}
原文地址: https://www.cveoy.top/t/topic/o70O 著作权归作者所有。请勿转载和采集!