-
Notifications
You must be signed in to change notification settings - Fork 2
/
Email.cs
32 lines (31 loc) · 1.14 KB
/
Email.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
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Web;
using System.Net.Mail;
namespace Travelling_SalesMan_Problem
{
class Email
{
public void SendEmail(string Reciever, string body)
{
string FinalBody = "*******Home Delivery Management System********** \n You are directed to follow following mentioned route while delivering orders. \n" + body + "\nReport Back to OI/C Delivery after delivery";
try
{
MailMessage mail = new MailMessage("[email protected]", Reciever, "Route of Delivery", FinalBody);
SmtpClient client = new SmtpClient("smtp.gmail.com");
client.Port = 587; //465
client.Credentials = new System.Net.NetworkCredential("[email protected]", "hamza@12345");
client.EnableSsl = true;
client.Send(mail);
Console.WriteLine("Email Send Successfully");
}
catch(Exception e)
{
new ShortestPath().NoInternet();
}
}
}
}