-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathEmail.cs
More file actions
71 lines (63 loc) · 2 KB
/
Email.cs
File metadata and controls
71 lines (63 loc) · 2 KB
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
using System;
using System.Collections.Generic;
using System.Text;
using System.Net;
using System.Net.Mail;
using System.Threading;
namespace RareHunter
{
class Email
{
public MailAddress mailAddress;
public string email, host, password;
public int port;
public bool enabless1;
public string subject, body;
public Email(string email, string host, int port, bool enabless1, string password)
{
this.email = email;
this.password = password;
this.host = host;
this.port = port;
this.enabless1 = enabless1;
}
public void sendEmail(string subject, string body)
{
this.subject = subject;
this.body = body;
Thread send = new Thread(threadSend);
send.Start();
}
public void threadSend()
{
try
{
mailAddress = new MailAddress(email, "Rare Hunter");
string fromPassword = password;
var smtp = new SmtpClient
{
Host = host,
Port = port,
EnableSsl = enabless1,
DeliveryMethod = SmtpDeliveryMethod.Network,
UseDefaultCredentials = false,
Credentials = new NetworkCredential(mailAddress.Address, fromPassword)
};
using (var message = new MailMessage(mailAddress, mailAddress)
{
Subject = this.subject,
Body = this.body
})
{
smtp.Send(message);
RareHunter.emailSending = false;
}
}
catch (Exception e)
{
Util.WriteToChat("ERROR SENDING EMAIL. PLEASE CHECK YOUR SETTINGS!");
}
return;
}
}
}