forked from medOblla/bingoDesk
-
Notifications
You must be signed in to change notification settings - Fork 1
/
ReplayRec.cs
73 lines (67 loc) · 2.57 KB
/
ReplayRec.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
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
72
73
using System;
using System.Windows.Forms;
using System.Net;
using System.Net.Mail;
using System.Collections.Generic;
using BingoStore.Models;
using BingoStore.APIs;
namespace BingoStore
{
public partial class ReplayRec : UserControl
{
private string last_name;
private string first_name;
private string email;
private string review;
private int review_id;
public ReplayRec(int review_id, string email, string last_name, string first_name, string review)
{
InitializeComponent();
this.email = email;
this.review_id = review_id;
this.review = review;
this.last_name = last_name;
this.first_name = first_name;
description.Text = this.review;
title.Text = this.first_name + " " +this.last_name;
}
private void send_Click(object sender, EventArgs e)
{
MailAddress from = new MailAddress("gi.forum99@gmail.com", "Bingo Team");
MailAddress to = new MailAddress("med.oblla@gmail.com", "Jane Clayton");
MailMessage message = new MailMessage(from, to);
// message.Subject = "Using the SmtpClient class.";
message.Subject = subject.Text;
message.Body = @emailmessage.Text;
// Add a carbon copy recipient.
MailAddress copy = new MailAddress("Notification_List@contoso.com");
message.CC.Add(copy);
SmtpClient client = new SmtpClient();
// Include credentials if the server requires them.
client.UseDefaultCredentials = false;
client.Host = "smtp.gmail.com";
client.Port = 587;
client.Credentials = new NetworkCredential("gi.forum99@gmail.com", "bestForum321");
client.EnableSsl = true;
Console.WriteLine("Sending an email message to {0} by using the SMTP host {1}.",
to.Address, client.Host);
try
{
client.Send(message);
MessageBox.Show("Succesfully Replayed !");
Review.Reply_review(review_id);
}
catch (Exception ex)
{
Console.WriteLine("Exception caught in CreateCopyMessage(): {0}",
ex.ToString());
MessageBox.Show("Something Went Wrong !");
}
}
private void back_Click(object sender, EventArgs e)
{
ShowReports d1 = new ShowReports();
MainControlClass.showControl(d1, this);
}
}
}