private void /JobSubmitRequestEnhancedEmail_Click(object sender, EventArgs e) // setup Authentication objects EMsgAPI_Demo.EMsgAPI_JobSubmit_200907.Authentication EMAuthentication = new EMsgAPI_Demo.EMsgAPI_JobSubmit_200907.Authentication(); EMsgAPI_Demo.EMsgAPI_JobSubmit_200907.XDDSAuthType XDDSAuth = new EMsgAPI_Demo.EMsgAPI_JobSubmit_200907.XDDSAuthType(); // init Authentication objects XDDSAuth.Password = txtAccessCode.Text; XDDSAuth.RequesterID = txtUserId.Text; EMAuthentication.XDDSAuth = XDDSAuth; // Setup MessageObject EMsgAPI_Demo.EMsgAPI_JobSubmit_200907.MessageType[] JS_Message = new EMsgAPI_Demo.EMsgAPI_JobSubmit_200907.MessageType[1]; JS_Message[0] = new EMsgAPI_Demo.EMsgAPI_JobSubmit_200907.MessageType(); // Setup JobOptions - CREF, Billing Code, FAX EMsgAPI_Demo.EMsgAPI_JobSubmit_200907.JobOptionsType JS_JobOptions = new EMsgAPI_Demo.EMsgAPI_JobSubmit_200907.JobOptionsType(); EMsgAPI_Demo.EMsgAPI_JobSubmit_200907.EncodableStringType JS_CRef = new EMsgAPI_Demo.EMsgAPI_JobSubmit_200907.EncodableStringType(); EMsgAPI_Demo.EMsgAPI_JobSubmit_200907.EncodableStringType JS_BCode = new EMsgAPI_Demo.EMsgAPI_JobSubmit_200907.EncodableStringType(); EMsgAPI_Demo.EMsgAPI_JobSubmit_200907.EnhancedEmailOptionsType JS_EnhancedEmailOptions = new EMsgAPI_Demo.EMsgAPI_JobSubmit_200907.EnhancedEmailOptionsType(); // set CREF and Billing Code JS_CRef.Value = txtCRef.Text; JS_BCode.Value = txtBC.Text; JS_JobOptions.CustomerReference = JS_CRef; JS_JobOptions.BillingCode = JS_BCode; //// Set Start and End Time //DateTime StartDateValue = new DateTime(dateTimePicker1.Value.Year, dateTimePicker1.Value.Month, dateTimePicker1.Value.Day, dateTimePicker1.Value.Hour, dateTimePicker1.Value.Minute, 0, dateTimePicker1.Value.Kind); //DateTime EndDateValue = new DateTime(dateTimePicker2.Value.Year, dateTimePicker2.Value.Month, dateTimePicker2.Value.Day, dateTimePicker2.Value.Hour, dateTimePicker2.Value.Minute, 0, dateTimePicker2.Value.Kind); EMsgAPI_Demo.EMsgAPI_JobSubmit_200907.DeliveryType ScheduledDelivery = new EMsgAPI_Demo.EMsgAPI_JobSubmit_200907.DeliveryType(); ScheduledDelivery.Schedule = EMsgAPI_Demo.EMsgAPI_JobSubmit_200907.ScheduleType.express; //ScheduledDelivery.ScheduleSpecified = true; //ScheduledDelivery.StartTimeSpecified = true; //ScheduledDelivery.StopTimeSpecified = true; //ScheduledDelivery.StartTime = StartDateValue; //ScheduledDelivery.StopTime = EndDateValue; JS_JobOptions.Delivery = ScheduledDelivery; // Set EnhancedEmailOptions // Set Expiration JS_EnhancedEmailOptions.ExpirationDays = 1; JS_EnhancedEmailOptions.ExpirationDaysSpecified = true; // Set HTML Open Tracking JS_EnhancedEmailOptions.HTMLOpenTracking = EMsgAPI_Demo.EMsgAPI_JobSubmit_200907.HTMLOpenTrackingType.top; JS_EnhancedEmailOptions.HTMLOpenTrackingSpecified = true; // Set Subject EMsgAPI_Demo.EMsgAPI_JobSubmit_200907.EncodableStringType Email_Subject = new EMsgAPI_Demo.EMsgAPI_JobSubmit_200907.EncodableStringType(); Email_Subject.Value = txtEnhancedSubject.Text; JS_EnhancedEmailOptions.Subject = Email_Subject; // Set From Information JS_EnhancedEmailOptions.FromDisplayName = "Bruce Rechichar"; // Friendly From //JS_EnhancedEmailOptions.ReplyTo = "ptooma85@hotmail.com"; //JS_EnhancedEmailOptions.FromAddress = "bruce.rechichar@gmail.com"; // Spoofed From //// Set SendAFriend Options //JS_EnhancedEmailOptions.AutoSendFriend = EMsgAPI_Demo.EMsgAPI_JobSubmit_200907.YesNo.yes; //JS_EnhancedEmailOptions.AutoSendFriendSpecified = true; // Set JobOptions as EnhancedEmailOptions JS_JobOptions.EnhancedEmailOptions = JS_EnhancedEmailOptions; // Set Message Object JS_Message[0].JobOptions = JS_JobOptions; // Free Objects JS_JobOptions = null; JS_EnhancedEmailOptions = null; JS_CRef = null; JS_BCode = null; Email_Subject = null; // Setup Documents EMsgAPI_Demo.EMsgAPI_JobSubmit_200907.DocumentType[] JS_Documents = new EMsgAPI_Demo.EMsgAPI_JobSubmit_200907.DocumentType[5]; JS_Documents[0] = new EMsgAPI_Demo.EMsgAPI_JobSubmit_200907.DocumentType(); JS_Documents[1] = new EMsgAPI_Demo.EMsgAPI_JobSubmit_200907.DocumentType(); JS_Documents[2] = new EMsgAPI_Demo.EMsgAPI_JobSubmit_200907.DocumentType(); JS_Documents[3] = new EMsgAPI_Demo.EMsgAPI_JobSubmit_200907.DocumentType(); JS_Documents[4] = new EMsgAPI_Demo.EMsgAPI_JobSubmit_200907.DocumentType(); //JS_Documents[5] = new EMsgAPI_Demo.EMsgAPI_JobSubmit_200907.DocumentType(); // Setup reusable variables for the document EMsgAPI_Demo.EMsgAPI_JobSubmit_200907.DocDataType DocData = new EMsgAPI_Demo.EMsgAPI_JobSubmit_200907.DocDataType(); string File; // Setup Document 1 - HTML Body File = ReadAndEncodedFile(txtHTMLBody.Text); DocData.format = EMsgAPI_Demo.EMsgAPI_JobSubmit_200907.DocEncodingFormat.base64; DocData.Value = File; JS_Documents[0].Item = DocData; JS_Documents[0].DocType = "HTML"; JS_Documents[0].ItemElementName = EMsgAPI_Demo.EMsgAPI_JobSubmit_200907.ItemChoiceType.DocData; JS_Documents[0].@ref = "HTML_Body"; DocData = null; // Setup Document 2 - TEXT Body DocData = new EMsgAPI_Demo.EMsgAPI_JobSubmit_200907.DocDataType(); File = ReadAndEncodedFile(txtTEXTBody.Text, true); DocData.format = EMsgAPI_Demo.EMsgAPI_JobSubmit_200907.DocEncodingFormat.base64; DocData.Value = File; JS_Documents[1].Item = DocData; EMsgAPI_Demo.EMsgAPI_JobSubmit_200907.EncodableStringType myFileName = new EMsgAPI_Demo.EMsgAPI_JobSubmit_200907.EncodableStringType(); myFileName.Value = "TEXT_Body.txt"; JS_Documents[1].Filename = myFileName; JS_Documents[1].DocType = "text"; JS_Documents[1].ItemElementName = EMsgAPI_Demo.EMsgAPI_JobSubmit_200907.ItemChoiceType.DocData; JS_Documents[1].@ref = "TEXT_Body"; DocData = null; // Setup Document 3 - CSV List DocData = new EMsgAPI_Demo.EMsgAPI_JobSubmit_200907.DocDataType(); File = ReadAndEncodedFile(txtCSVList.Text, true); DocData.format = EMsgAPI_Demo.EMsgAPI_JobSubmit_200907.DocEncodingFormat.base64; DocData.Value = File; JS_Documents[2].Item = DocData; myFileName.Value = "CSVList.csv"; JS_Documents[2].Filename = myFileName; JS_Documents[2].DocType = "text"; JS_Documents[2].ItemElementName = EMsgAPI_Demo.EMsgAPI_JobSubmit_200907.ItemChoiceType.DocData; JS_Documents[2].@ref = "CSVList1"; DocData = null; //// Setup Document - Pull File 1 //DocData = new EMsgAPI_Demo.EMsgAPI_JobSubmit_200907.DocDataType(); //File = ReadAndEncodedFile(txtPull1.Text, true); //DocData.format = EMsgAPI_Demo.EMsgAPI_JobSubmit_200907.DocEncodingFormat.base64; //DocData.Value = File; // Get Filename information along with Extension //System.IO.FileInfo oFileInfo = new System.IO.FileInfo(txtAttach1.Text); //JS_Documents[3].Item = DocData; //JS_Documents[3].Filename = oFileInfo.Name; //JS_Documents[3].DocType = "HTML"; //JS_Documents[3].ItemElementName = EMsgAPI_Demo.EMsgAPI_JobSubmit_200907.ItemChoiceType.DocData; //JS_Documents[3].@ref = "PULL1"; //DocData = null; //oFileInfo = null; //// Setup Document - Pull File 2 //DocData = new EMsgAPI_Demo.EMsgAPI_JobSubmit_200907.DocDataType(); //File = ReadAndEncodedFile(txtPull2.Text, true); //DocData.format = EMsgAPI_Demo.EMsgAPI_JobSubmit_200907.DocEncodingFormat.base64; //DocData.Value = File; //// Get Filename information along with Extension //oFileInfo = new System.IO.FileInfo(txtPull2.Text); //JS_Documents[4].Item = DocData; //JS_Documents[4].Filename = oFileInfo.Name; //JS_Documents[4].DocType = "JPEG"; //JS_Documents[4].ItemElementName = EMsgAPI_Demo.EMsgAPI_JobSubmit_200907.ItemChoiceType.DocData; //JS_Documents[4].@ref = "PULL2"; //DocData = null; //oFileInfo = null; // Setup Document - Attachment 1 DocData = new EMsgAPI_Demo.EMsgAPI_JobSubmit_200907.DocDataType(); File = ReadAndEncodedFile(txtAttach1.Text, true); DocData.format = EMsgAPI_Demo.EMsgAPI_JobSubmit_200907.DocEncodingFormat.base64; DocData.Value = File; // Get Filename information along with Extension System.IO.FileInfo oFileInfo = new System.IO.FileInfo(txtAttach1.Text); JS_Documents[3].Item = DocData; myFileName.Value = oFileInfo.Name; JS_Documents[3].Filename = myFileName; JS_Documents[3].DocType = "PDF"; JS_Documents[3].ItemElementName = EMsgAPI_Demo.EMsgAPI_JobSubmit_200907.ItemChoiceType.DocData; JS_Documents[3].@ref = "ATTACH1"; DocData = null; oFileInfo = null; // Setup Document - Attachment 2 DocData = new EMsgAPI_Demo.EMsgAPI_JobSubmit_200907.DocDataType(); File = ReadAndEncodedFile(txtPull2.Text, true); DocData.format = EMsgAPI_Demo.EMsgAPI_JobSubmit_200907.DocEncodingFormat.base64; DocData.Value = File; // Get Filename information along with Extension oFileInfo = new System.IO.FileInfo(txtAttach1.Text); JS_Documents[4].Item = DocData; myFileName.Value = oFileInfo.Name; JS_Documents[4].Filename = myFileName; JS_Documents[4].DocType = "MSW"; JS_Documents[4].ItemElementName = EMsgAPI_Demo.EMsgAPI_JobSubmit_200907.ItemChoiceType.DocData; JS_Documents[4].@ref = "ATTACH2"; DocData = null; oFileInfo = null; // Setup Content EMsgAPI_Demo.EMsgAPI_JobSubmit_200907.ContentPartType[] JS_Content = new EMsgAPI_Demo.EMsgAPI_JobSubmit_200907.ContentPartType[4]; JS_Content[0] = new EMsgAPI_Demo.EMsgAPI_JobSubmit_200907.ContentPartType(); JS_Content[1] = new EMsgAPI_Demo.EMsgAPI_JobSubmit_200907.ContentPartType(); JS_Content[2] = new EMsgAPI_Demo.EMsgAPI_JobSubmit_200907.ContentPartType(); JS_Content[3] = new EMsgAPI_Demo.EMsgAPI_JobSubmit_200907.ContentPartType(); //JS_Content[4] = new EMsgAPI_Demo.EMsgAPI_JobSubmit_200907.ContentPartType(); // Setup references to documents JS_Content[0].Item = "HTML_Body"; JS_Content[0].Treatment = EMsgAPI_Demo.EMsgAPI_JobSubmit_200907.TreatmentType.body; JS_Content[0].TreatmentSpecified = true; JS_Content[1].Item = "TEXT_Body"; JS_Content[1].Treatment = EMsgAPI_Demo.EMsgAPI_JobSubmit_200907.TreatmentType.body; JS_Content[1].TreatmentSpecified = true; //JS_Content[2].Item = "PULL1"; //JS_Content[2].Treatment = EMsgAPI_Demo.EMsgAPI_JobSubmit_200907.TreatmentType.pullfile; //JS_Content[2].TreatmentSpecified = true; ////EMsgAPI_Demo.EMsgAPI_JobSubmit_200907.PullfileOptionsType PullFileOptions = new EMsgAPI_Demo.EMsgAPI_JobSubmit_200907.PullfileOptionsType(); ////PullFileOptions.AutoPull = EMsgAPI_Demo.EMsgAPI_JobSubmit_200907.YesNo.no; ////PullFileOptions.AutoPullSpecified = true; ////JS_Content[2].PullfileOptions = PullFileOptions; ////PullFileOptions = null; //JS_Content[3].Item = "PULL2"; //JS_Content[3].Treatment = EMsgAPI_Demo.EMsgAPI_JobSubmit_200907.TreatmentType.pullfile; //JS_Content[3].TreatmentSpecified = true; ////PullFileOptions = new EMsgAPI_Demo.EMsgAPI_JobSubmit_200907.PullfileOptionsType(); ////PullFileOptions.AutoPull = EMsgAPI_Demo.EMsgAPI_JobSubmit_200907.YesNo.yes; ////PullFileOptions.AutoPullSpecified = true; ////JS_Content[3].PullfileOptions = PullFileOptions; ////PullFileOptions = null; JS_Content[2].Item = "ATTACH1"; JS_Content[2].Treatment = EMsgAPI_Demo.EMsgAPI_JobSubmit_200907.TreatmentType.attachment; JS_Content[2].TreatmentSpecified = true; JS_Content[3].Item = "ATTACH2"; JS_Content[3].Treatment = EMsgAPI_Demo.EMsgAPI_JobSubmit_200907.TreatmentType.attachment; JS_Content[3].TreatmentSpecified = true; // Setup Content Object (documents are referenced here) // Setup table for list EMsgAPI_Demo.EMsgAPI_JobSubmit_200907.TableType[] CSVList_Table = new EMsgAPI_Demo.EMsgAPI_JobSubmit_200907.TableType[1]; CSVList_Table[0] = new EMsgAPI_Demo.EMsgAPI_JobSubmit_200907.TableType(); CSVList_Table[0].Item = "CSVList1"; CSVList_Table[0].@ref = "CSVList_Table1"; // Setup ALL Report Options EMsgAPI_Demo.EMsgAPI_JobSubmit_200907.ReportOptionsType JS_Report = new EMsgAPI_Demo.EMsgAPI_JobSubmit_200907.ReportOptionsType(); // Setup Delivery Report EMsgAPI_Demo.EMsgAPI_JobSubmit_200907.ReportOptionsTypeDeliveryReport JS_Delivery_Report = new EMsgAPI_Demo.EMsgAPI_JobSubmit_200907.ReportOptionsTypeDeliveryReport(); JS_Delivery_Report.DeliveryReportType = EMsgAPI_Demo.EMsgAPI_JobSubmit_200907.MainReportTypeEnum.none; JS_Report.DeliveryReport = JS_Delivery_Report; // Setup Final Report EMsgAPI_Demo.EMsgAPI_JobSubmit_200907.ReportOptionsTypeFinalReport JS_Final_Report = new EMsgAPI_Demo.EMsgAPI_JobSubmit_200907.ReportOptionsTypeFinalReport(); JS_Final_Report.ReportType = EMsgAPI_Demo.EMsgAPI_JobSubmit_200907.AllReportTypeEnum.none; JS_Report.FinalReport = JS_Final_Report; // Setup Progress Report EMsgAPI_Demo.EMsgAPI_JobSubmit_200907.ReportOptionsTypeProgressReport JS_Progress_Report = new EMsgAPI_Demo.EMsgAPI_JobSubmit_200907.ReportOptionsTypeProgressReport(); JS_Progress_Report.ProgressReportType = EMsgAPI_Demo.EMsgAPI_JobSubmit_200907.AllReportTypeEnum.none; JS_Report.ProgressReport = JS_Progress_Report; JS_Progress_Report.ProgressReportType = EMsgAPI_Demo.EMsgAPI_JobSubmit_200907.AllReportTypeEnum.conditional; EMsgAPI_Demo.EMsgAPI_JobSubmit_200907.InternetType[] JS_Report_Address = new EMsgAPI_Demo.EMsgAPI_JobSubmit_200907.InternetType[1]; JS_Report_Address[0] = new EMsgAPI_Demo.EMsgAPI_JobSubmit_200907.InternetType(); JS_Report_Address[0].Email = "bruce.rechichar@premiereglobal.com"; JS_Progress_Report.ReportAddress = JS_Report_Address; JS_Progress_Report.ProgressReportIntervals = "5 10"; DateTime BaseValue = DateTime.Now; JS_Progress_Report.ProgressReportBase = BaseValue.AddMinutes(5); JS_Progress_Report.ProgressReportBaseSpecified = true; JS_Report.ProgressReport = JS_Progress_Report; // Setup Friend Report EMsgAPI_Demo.EMsgAPI_JobSubmit_200907.ReportOptionsTypeFriendReport JS_Friend_Report = new EMsgAPI_Demo.EMsgAPI_JobSubmit_200907.ReportOptionsTypeFriendReport(); JS_Friend_Report.FriendReportType = EMsgAPI_Demo.EMsgAPI_JobSubmit_200907.FriendReportTypeEnum.none; JS_Report.FriendReport = JS_Friend_Report; //EMsgAPI_Demo.EMsgAPI_JobSubmit_200907.InternetType[] JS_Friend_Address = new EMsgAPI_Demo.EMsgAPI_JobSubmit_200907.InternetType[1]; //JS_Friend_Address[0] = new EMsgAPI_Demo.EMsgAPI_JobSubmit_200907.InternetType(); //JS_Friend_Address[0].Email = "bruce.rechichar@premiereglobal.com"; //JS_Friend_Report.ReportAddress = JS_Friend_Address; //JS_Friend_Report.FriendReportType = EMsgAPI_Demo.EMsgAPI_JobSubmit_200907.FriendReportTypeEnum.detail; JS_Report.FriendReport = JS_Friend_Report; JS_Message[0].Reports = JS_Report; JS_Message[0].Contents = JS_Content; JS_Message[0].Destinations = CSVList_Table; JS_Message[0].MessageId = System.Environment.MachineName + DateTime.Now; // Free Objects CSVList_Table = null; JS_Content = null; //// Setup Object for List Information (this is for a stored list) //EMsgAPI_Demo.EMsgAPI_JobSubmit_200907.ListType[] Lists = new EMsgAPI_Demo.EMsgAPI_JobSubmit_200907.ListType[1]; //Lists[0] = new EMsgAPI_Demo.EMsgAPI_JobSubmit_200907.ListType(); //Lists[0].ownershipLevel = EMsgAPI_Demo.EMsgAPI_JobSubmit_200907.OwnershipLevelType.user; //Lists[0].ownershipLevelSpecified = true; //Lists[0].Name = "bruceemail"; //Lists[0].@ref = "bruceemail"; //JS_Message[0].Destinations = Lists; //Lists = null; // Everything is Setup Prepare to Launch Job // First check to see if we need to setup proxy // setup EMsgAPI object - EM EMsgAPI_Demo.EMsgAPI_JobSubmit_200907.XOA EM = new EMsgAPI_Demo.EMsgAPI_JobSubmit_200907.XOA(); // Setup Request and JobSubmitRequest object EMsgAPI_Demo.EMsgAPI_JobSubmit_200907.Request Request = new EMsgAPI_Demo.EMsgAPI_JobSubmit_200907.Request(); EMsgAPI_Demo.EMsgAPI_JobSubmit_200907.Response Response = new EMsgAPI_Demo.EMsgAPI_JobSubmit_200907.Response(); EMsgAPI_Demo.EMsgAPI_JobSubmit_200907.JobSubmitRequest JS_Request = new EMsgAPI_Demo.EMsgAPI_JobSubmit_200907.JobSubmitRequest(); EMsgAPI_Demo.EMsgAPI_JobSubmit_200907.JobSubmitResult JS_Result = new EMsgAPI_Demo.EMsgAPI_JobSubmit_200907.JobSubmitResult(); // Setup Proxy server and EMsgAPIConnect URL for posting data Set_Server_and_Proxy(EM); // Setup Reqeust Object if (cmbServer.Text.Contains("Async")) { Request.SenderKey = "http://www.bdrsoftware.com/Service1.asmx"; } // Setup Reqeust Object Request.ReceiverKey = EM.Url; Request.Authentication = EMAuthentication; Request.ResultRequired = EMsgAPI_Demo.EMsgAPI_JobSubmit_200907.RequiredType.yes; Request.ResponseRequiredSpecified = true; // Assign Reqeust and Response objects to EM Object EM.RequestValue = Request; EM.ResponseValue = Response; JS_Request.Message = JS_Message; JS_Request.DocumentSet = JS_Documents; JS_Request.SubmitId = "SUBMITID_EMAIL"; try { if (cmbServer.Text.Contains("Async")) { EM.JobSubmit(JS_Request); JS_Result = null; } else JS_Result = EM.JobSubmit(JS_Request); } catch (Exception ex) { System.Console.WriteLine(ex.Message); System.Console.Read(); return; } if (JS_Result != null) { if (JS_Result.Status.StatusCode != null) { string JobNumber; JobNumber = JS_Result.MessageResult[0].JobId.XDN + ":" + JS_Result.MessageResult[0].JobId.MRN; txtJobNumber.Text = JobNumber; } } }