diff options
| author | Roy Ben-Shabat <Roy@Twine-s.com> | 2018-05-08 17:01:22 +0300 |
|---|---|---|
| committer | Roy Ben-Shabat <Roy@Twine-s.com> | 2018-05-08 17:01:22 +0300 |
| commit | 113eaf4d8a37e212b8528d41e400b346ce9f51d2 (patch) | |
| tree | 757df6c19de09061fad3b5a0b3954f0bbc98747b /Software/Visual_Studio/Tango.UnitTesting/Outlook_TST.cs | |
| parent | cdba3267d2a47b3bff8cf3ec0219223e36e234ff (diff) | |
| download | Tango-113eaf4d8a37e212b8528d41e400b346ce9f51d2.tar.gz Tango-113eaf4d8a37e212b8528d41e400b346ce9f51d2.zip | |
Added improvements to stubs UI.
Implemented Bug Reporter engine!
Diffstat (limited to 'Software/Visual_Studio/Tango.UnitTesting/Outlook_TST.cs')
| -rw-r--r-- | Software/Visual_Studio/Tango.UnitTesting/Outlook_TST.cs | 33 |
1 files changed, 32 insertions, 1 deletions
diff --git a/Software/Visual_Studio/Tango.UnitTesting/Outlook_TST.cs b/Software/Visual_Studio/Tango.UnitTesting/Outlook_TST.cs index b34db8578..57a22dbd9 100644 --- a/Software/Visual_Studio/Tango.UnitTesting/Outlook_TST.cs +++ b/Software/Visual_Studio/Tango.UnitTesting/Outlook_TST.cs @@ -2,7 +2,9 @@ using Microsoft.VisualStudio.TestTools.UnitTesting; using System; using System.Collections.Generic; +using System.IO; using System.Linq; +using System.Net.Mail; using System.Text; using System.Threading.Tasks; using Outlook = Microsoft.Office.Interop.Outlook; @@ -14,7 +16,7 @@ namespace Tango.UnitTesting public class Outlook_TST { [TestMethod] - public void Send_Email_With_Logs() + public void Send_Email_With_Logs_Using_Outlook() { Application app = new Application(); MailItem email = (MailItem)app.CreateItem(OlItemType.olMailItem); @@ -31,5 +33,34 @@ namespace Tango.UnitTesting email.Importance = OlImportance.olImportanceNormal; email.Send(); } + + [TestMethod] + public void Send_Email_With_Logs_With_Outlook_SMTP() + { + String sender = "roy@twine-s.com"; + String recipient = "roy@twine-s.com"; + + SmtpClient client = new SmtpClient("smtp-mail.outlook.com"); + + client.Port = 587; + client.DeliveryMethod = SmtpDeliveryMethod.Network; + client.UseDefaultCredentials = false; + System.Net.NetworkCredential credentials = new System.Net.NetworkCredential(sender, "Maya2018"); + client.EnableSsl = true; + client.Credentials = credentials; + + try + { + var mail = new MailMessage(sender.Trim(), recipient.Trim()); + mail.Attachments.Add(new System.Net.Mail.Attachment(new FileStream("D:\\C#.txt", FileMode.Open), "C# Code")); + mail.Subject = "Test Email"; + mail.Body = "This is a test."; + client.Send(mail); + } + catch (System.Exception ex) + { + throw ex; + } + } } } |
