-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSender.cs
31 lines (24 loc) · 849 Bytes
/
Sender.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
28
29
30
31
using System.Net.Mail;
using System.Net;
namespace Logger
{
internal class Sender
{
private string senderEmail = "yourEmail";
private string senderPassword = "yourPassword";
private string recipientEmail = "yourEmail";
public void Send(string text)
{
MailAddress from = new MailAddress(senderEmail, "test");
MailAddress to = new MailAddress(recipientEmail);
MailMessage message = new MailMessage(from, to);
message.Subject = "Record";
message.Body = text;
message.IsBodyHtml = true;
SmtpClient smtp = new SmtpClient("smtp.gmail.com", 587);
smtp.Credentials = new NetworkCredential(senderEmail, senderPassword);
smtp.EnableSsl = true;
smtp.Send(message);
}
}
}