-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathemail.js
49 lines (40 loc) · 1.32 KB
/
email.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
const Discord = require("discord.js");
const fs = require('fs');
const nodemailer = require('nodemailer');
module.exports = {
info: {
name: "email",
description: "email whoever",
usage: "[email]",
aliases: ["email"],
},
run: async function (client, message, args) {
if (message.author.id != "461959539114246175") return message.channel.send("You're not the bot the owner!");
var searchStringe = args.join(" ");
if (!searchStringe) return message.channel.send("You didn't provide an email to send a message to");
var searchStringee = (args.splice(1).join(" "));
if (!searchStringee) return message.channel.send("You didn't provide a message to send");
var transporter = nodemailer.createTransport({
service: 'put what the meial service is here ex. yahoo, gmail...',
auth: {
user: 'put the email to send from here',
pass: 'put the email password here'
}
});
var mailOptions = {
from: 'put the sent from email here',
to: searchStringe,
subject: 'Sent from a discord bot',
text: searchStringee
};
transporter.sendMail(mailOptions, function(error, info){
if (error) {
console.log(error);
message.channel.send("Error sending message!")
} else {
console.log('Email sent: ' + info.response);
message.channel.send("Email Sent!")
}
});
},
};