|
@@ -7,6 +7,7 @@ namespace UnivateProperties_API.Repository.Communication
|
7
|
7
|
public interface IMailRepository
|
8
|
8
|
{
|
9
|
9
|
void ContactUs(MailModel mm);
|
|
10
|
+ void EnquireNow(MailModel mm);
|
10
|
11
|
}
|
11
|
12
|
|
12
|
13
|
public class MailRepository : IMailRepository
|
|
@@ -55,5 +56,42 @@ namespace UnivateProperties_API.Repository.Communication
|
55
|
56
|
client.Disconnect(true);
|
56
|
57
|
client.Dispose();
|
57
|
58
|
}
|
|
59
|
+
|
|
60
|
+ public void EnquireNow(MailModel mm)
|
|
61
|
+ {
|
|
62
|
+ string phone = mm.Phone;
|
|
63
|
+ string name = mm.Name;
|
|
64
|
+ string email = mm.Email;
|
|
65
|
+ string message = mm.Message;
|
|
66
|
+
|
|
67
|
+ from = new MailboxAddress("Admin", mm.FromAddress);
|
|
68
|
+
|
|
69
|
+ to = new MailboxAddress("User", mm.ToAddress);
|
|
70
|
+
|
|
71
|
+ messageObj.From.Add(from);
|
|
72
|
+ messageObj.To.Add(to);
|
|
73
|
+
|
|
74
|
+ messageObj.Subject = "Uni-Vate - Enquiry to view property";
|
|
75
|
+
|
|
76
|
+ bodyBuilder.HtmlBody = "<div style=\"margin: 5px\">" +
|
|
77
|
+ "<h4>Contact from: " + name + "!</h4>" +
|
|
78
|
+ "<h4>Email: " + email + "</h4>" +
|
|
79
|
+ "<h4>Phone: " + phone + "</h4>" +
|
|
80
|
+ "<div>" +
|
|
81
|
+ "<h4>Message: </h4>" +
|
|
82
|
+ "<p>" + message + "</p>" +
|
|
83
|
+ "</div>" +
|
|
84
|
+ "</div>" +
|
|
85
|
+ "</div>";
|
|
86
|
+
|
|
87
|
+ messageObj.Body = bodyBuilder.ToMessageBody();
|
|
88
|
+
|
|
89
|
+ client.Connect("smtp.gmail.com", 465, true);
|
|
90
|
+ client.Authenticate("jlouw365@gmail.com", "setskohatxpsceqo");
|
|
91
|
+
|
|
92
|
+ client.Send(messageObj);
|
|
93
|
+ client.Disconnect(true);
|
|
94
|
+ client.Dispose();
|
|
95
|
+ }
|
58
|
96
|
}
|
59
|
97
|
}
|