forked from lmccay4/TwitterFollowerMonitor
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathEmailer.cs
27 lines (22 loc) · 770 Bytes
/
Emailer.cs
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
using System;
using System.Net.Mail;
namespace NoahnFollowers
{
public class Emailer
{
public static void SendEmail(string subject, string body)
{
MailMessage mail = new MailMessage();
SmtpClient SmtpServer = new SmtpClient("smtp.gmail.com");
mail.From = new MailAddress("YOUR EMAIL HERE");
mail.To.Add("RECIPIENT EMIAL");
mail.Subject = subject;
mail.Body = body;
SmtpServer.Port = 587;
SmtpServer.Credentials = new System.Net.NetworkCredential("GMAIL USERNAME", "GMAIL PASSWORD");
SmtpServer.EnableSsl = true;
SmtpServer.Send(mail);
Console.WriteLine($"Email sent: {subject} {body}");
}
}
}