public async Task <DisplayObject> GetHelpMeMailAsync() { try { using (var client = new ImapClient()) { client.Connect("outlook.office365.com", 993, true); client.Authenticate( "*****@*****.**", @"*Jk-cq3""sKr6T]\h" ); var inbox = client.Inbox; inbox.Open(FolderAccess.ReadOnly); var strOut = new List <string>(); strOut.Add("Total Messages: " + inbox.Count); strOut.Add("Messages follow:"); var msgs = new List <MimeMessage>(); for (int i = 0; i < inbox.Count; i++) { msgs.Add(inbox.GetMessage(i)); } client.Disconnect(true); foreach (var email in msgs) { var emailMessage = email.BodyParts.OfType <TextPart>().FirstOrDefault()?.Text; List <RecycProgramDetails> programs = new List <RecycProgramDetails>(); var receiptItems = ReturnReceiptItems(emailMessage); var zip = GetUserZipCode(emailMessage); var zipResults = await _earth911service.GetZipLocationDetails(zip); foreach (var result in zipResults.result) { programs.Add(result.Value); } return(new DisplayObject() { Programs = programs, ReceiptItems = receiptItems }); } } return(null); } catch (Exception ex) { throw ex; } }
public async Task <ActionResult> GetZipDetails(string zipCode) { var location = await _e911Serivce.GetZipLocationDetails(zipCode); return(Ok(location)); }