public static async Task CMSFormComplete(IDialogContext context, IAwaitable <CMSFormRequest> result) { CMSFormRequest cmsRequest = null; try { cmsRequest = await result; } catch (OperationCanceledException) { await context.PostAsync("You Cancelled the form!"); return; } if (cmsRequest != null) { context.PrivateConversationData.SetValue("ProfileComplete", true); context.PrivateConversationData.SetValue("FullName", cmsRequest.FullName); context.PrivateConversationData.SetValue("Department", cmsRequest.Department); context.PrivateConversationData.SetValue("UserEmail", cmsRequest.userEmail); context.PrivateConversationData.SetValue("WebAddress", cmsRequest.WebAddress); if (cmsRequest.PhoneNumber == null) { context.PrivateConversationData.SetValue("Phone", ""); } else { context.PrivateConversationData.SetValue("Phone", cmsRequest.PhoneNumber); } if (cmsRequest.ExtraNotes == null) { context.PrivateConversationData.SetValue("ExtraNotes", ""); } else { context.PrivateConversationData.SetValue("ExtraNotes", cmsRequest.ExtraNotes); } context.PrivateConversationData.SetValue("SupervisorName", cmsRequest.SupervisorName); context.PrivateConversationData.SetValue("SupervisorEmail", cmsRequest.SupervisorEmail); SendEmail(cmsRequest, null); await context.PostAsync("A request for CMS Account is successfuly raised. You will receive a confirmation email."); } else { await context.PostAsync("Form returned empty response!"); } context.Done(true); }
public static void SendEmail(CMSFormRequest CmsRequest, NewWebsiteRequest NewWebsiteRequest) { var smtpClient = new System.Net.Mail.SmtpClient(); var msg = new System.Net.Mail.MailMessage(); msg.To.Add("*****@*****.**"); if (NewWebsiteRequest == null) { msg.Subject = "CMS Request - Test"; msg.Body = "CMS Request"; } else { msg.Subject = "New Website Request - Test"; msg.Body = "New Website Request"; } smtpClient.Send(msg); }
public static void SendEmail(CMSFormRequest CmsRequest, NewWebsiteRequest NewWebsiteRequest) { var smtpClient = new System.Net.Mail.SmtpClient(); var msg = new System.Net.Mail.MailMessage(); msg.To.Add("*****@*****.**"); if (NewWebsiteRequest == null) { msg.CC.Add(CmsRequest.userEmail); msg.Subject = "Episerver CMS: Account Request"; msg.Body = $"Authorization form for: \n \n EDITOR: {CmsRequest.FullName}\n SITE: {CmsRequest.WebAddress}\n\n FORM:\n Site to edit: {CmsRequest.WebAddress} \nName of editor: {CmsRequest.FullName}\n Phone: {CmsRequest.PhoneNumber}\n Department: {CmsRequest.Department} \n Email: {CmsRequest.userEmail}\nAccount: {CmsRequest.AccountOption}\n SupervisorName: {CmsRequest.SupervisorName}\n SupervisorEmail: {CmsRequest.SupervisorEmail}\n Comments: {CmsRequest.ExtraNotes} "; } else { msg.CC.Add(NewWebsiteRequest.userEmail); msg.Subject = "Episerver CMS: New Website Request"; msg.Body = $"New Website Request form for: \n \n Name: {NewWebsiteRequest.FullName}\n SITE: {NewWebsiteRequest.WebAddress}\n\n FORM:\n Site: {NewWebsiteRequest.WebAddress} \nName: {NewWebsiteRequest.FullName}\n Phone: {NewWebsiteRequest.PhoneNumber}\n Department: {NewWebsiteRequest.Department} \n Email: {NewWebsiteRequest.userEmail}\nAccount: {NewWebsiteRequest.AccountOption}\n TargetDate: {NewWebsiteRequest.TargetDate}\n Comments: {NewWebsiteRequest.ExtraNotes} "; } smtpClient.Send(msg); }