コード例 #1
0
 // perform post intialization
 protected override void OnInitialized()
 {
     base.OnInitialized();
     EmailProperty.SetValue("*****@*****.**");
     PasswordProperty.SetValue("password");
     TrackModifications = false;
     IsNew = false;
 }
コード例 #2
0
        public void ExecuteCommand(ValidationCommandContext context)
        {
            bool condition = Condition.Compile().Invoke();

            if (condition)
            {
                string value = EmailProperty.Compile().Invoke();
                if (!CheckIfEmail(value))
                {
                    var propertyName = EmailProperty.GetPropertyName();
                    context.AddError(new ValidationResult(ErrorMessage, new[] { propertyName }));
                }
            }
        }
コード例 #3
0
        public void Email_Tests()
        {
            try
            {
                emailService.ConvertMailMessageToTargetFormat("email-sample.mht", EmailFormat.Msg, Utils.CloudStorage_Input_Folder, Utils.Local_Output_Path + "email-output.msg");
                emailService.ConvertMailMessageToTargetFormat("email-sample.mht", EmailFormat.Msg, Utils.CloudStorage_Input_Folder, Utils.CloudStorage_Output_Folder + "/email-output.msg");

                EmailDocumentPropertiesResponse emailDocumentPropertiesResponse = emailService.GetMailCommonInfo("email-sample.msg", Utils.CloudStorage_Input_Folder);
                storageService.File.CopyFile(Utils.CloudStorage_Input_Folder + "/email-sample.msg", Utils.CloudStorage_Output_Folder + "/email-sample.msg");

                EmailDocumentPropertiesRequest emailDocumentPropertiesRequest = new EmailDocumentPropertiesRequest();
                emailDocumentPropertiesRequest.DocumentProperties = emailDocumentPropertiesResponse.DocumentProperties;

                // Removing attachments as it is not supported by this method
                emailDocumentPropertiesRequest.DocumentProperties.List.RemoveAt(emailDocumentPropertiesRequest.DocumentProperties.List.Count - 1);

                emailService.AddNewEmail("email-sample.msg", Utils.CloudStorage_Output_Folder, emailDocumentPropertiesRequest);

                //storageService.File.DownloadFile(Utils.CloudStorage_Output_Folder + "/email-sample.msg", Utils.Local_Output_Path + "email-created.msg");


                EmailProperty emailProperty = new EmailProperty();
                emailProperty.Name  = "Subject";
                emailProperty.Value = "My test subject";
                emailService.SetDocumentProperty("email-sample.mht", "Subject", emailProperty, Utils.CloudStorage_Input_Folder);

                EmailPropertyResponse emailPropertyResponse = emailService.ReadDocumentPropertyByName("email-sample.mht", "Subject", Utils.CloudStorage_Input_Folder);

                emailService.GetEmailAttachmentByName("email-sample.eml", "barcode-sample.png", Utils.CloudStorage_Input_Folder, Utils.Local_Output_Path + "email-attach-out.png");


                storageService.File.CopyFile(Utils.CloudStorage_Input_Folder + "/email-sample.eml", Utils.CloudStorage_Output_Folder + "/email-addAttach.eml");
                storageService.File.CopyFile(Utils.CloudStorage_Input_Folder + "/barcode-sample.png", Utils.CloudStorage_Output_Folder + "/barcode-sample2.png");
                emailService.AddEmailAttachment("email-addAttach.eml", Utils.CloudStorage_Output_Folder + "/barcode-sample2.png", Utils.CloudStorage_Output_Folder);
                emailService.GetEmailAttachmentByName("email-addAttach.eml", "barcode-sample2.png", Utils.CloudStorage_Output_Folder, Utils.Local_Output_Path + "/email-attach-out2.png");
            }
            catch (Exception ex)
            {
                Assert.Fail(ex.Message);
            }
        }
コード例 #4
0
        public static void Run()
        {
            // ExStart:1
            EmailApi   emailApi   = new EmailApi(Common.APP_KEY, Common.APP_SID, Common.BASEPATH);
            StorageApi storageApi = new StorageApi(Common.APP_KEY, Common.APP_SID, Common.BASEPATH);

            String fileName     = "email_test.eml";
            String propertyName = "Subject";
            String storage      = "";
            String folder       = "";

            EmailProperty emailSubject = new EmailProperty();

            emailSubject.Name  = "Subject";
            emailSubject.Value = "This is a new subject";

            try
            {
                // Upload source file to aspose cloud storage
                storageApi.PutCreate(fileName, "", "", System.IO.File.ReadAllBytes(Common.GetDataDir() + fileName));

                // Invoke Aspose.Email Cloud SDK API to set message property
                EmailPropertyResponse apiResponse = emailApi.PutSetEmailProperty(fileName, propertyName, storage, folder, emailSubject);

                if (apiResponse != null)
                {
                    Console.WriteLine("Property Name :: " + apiResponse.EmailProperty.Name);
                    Console.WriteLine("Property Value :: " + apiResponse.EmailProperty.Value);
                    Console.WriteLine("Set Message Property, Done!");
                    Console.ReadKey();
                }
            }
            catch (Exception ex)
            {
                System.Diagnostics.Debug.WriteLine("error:" + ex.Message + "\n" + ex.StackTrace);
            }
            // ExEnd:1
        }
コード例 #5
0
        public void TestPutSetEmailProperty()
        {
            EmailApi   target     = new EmailApi(APIKEY, APPSID, BASEPATH);
            StorageApi storageApi = new StorageApi(APIKEY, APPSID, BASEPATH);

            string        name         = "email_test.eml";
            string        propertyName = "Body";
            string        storage      = null;
            string        folder       = null;
            EmailProperty body         = new EmailProperty();

            body.Name  = "Subject";
            body.Value = "This is the subject";

            storageApi.PutCreate(name, null, null, System.IO.File.ReadAllBytes("\\temp\\email\\resources\\" + name));

            EmailPropertyResponse actual;

            actual = target.PutSetEmailProperty(name, propertyName, storage, folder, body);

            Assert.AreEqual("200", actual.Code);
            Assert.IsInstanceOfType(new EmailPropertyResponse(), actual.GetType());
        }
コード例 #6
0
        public void TestPutCreateNewEmail()
        {
            EmailApi   target     = new EmailApi(APIKEY, APPSID, BASEPATH);
            StorageApi storageApi = new StorageApi(APIKEY, APPSID, BASEPATH);

            string name    = "email_test.eml";
            string storage = null;
            string folder  = null;

            EmailDocument body = new EmailDocument();

            EmailProperties emailProperties = new EmailProperties();

            System.Collections.Generic.List <Link> links             = new System.Collections.Generic.List <Link> {
            };
            System.Collections.Generic.List <EmailProperty> empProps = new System.Collections.Generic.List <EmailProperty> {
            };


            Link link = new Link();

            link.Href  = "http://api.aspose.com/v1.1/pdf/";
            link.Rel   = "self";
            link.Title = "NewField";
            link.Type  = "link";
            links.Add(link);


            EmailProperty emailBody = new EmailProperty();
            EmailProperty emailTo   = new EmailProperty();
            EmailProperty emailFrom = new EmailProperty();

            emailBody.Name  = "Body";
            emailBody.Value = "This is the Body";
            emailBody.Link  = link;
            empProps.Add(emailBody);

            emailTo.Name  = "To";
            emailTo.Value = "*****@*****.**";
            emailTo.Link  = link;
            empProps.Add(emailTo);

            emailFrom.Name  = "From";
            emailFrom.Value = "*****@*****.**";
            emailFrom.Link  = link;
            empProps.Add(emailFrom);


            emailProperties.List = empProps;
            emailProperties.Link = link;

            body.DocumentProperties = emailProperties;
            body.Links = links;

            storageApi.PutCreate(name, null, null, System.IO.File.ReadAllBytes("\\temp\\email\\resources\\" + name));

            EmailDocumentResponse actual;

            actual = target.PutCreateNewEmail(name, storage, folder, body);

            Assert.AreEqual("200", actual.Code);
            Assert.IsInstanceOfType(new EmailDocumentResponse(), actual.GetType());
        }
コード例 #7
0
 set => SetValue(EmailProperty, value);
コード例 #8
0
        public static void Run()
        {
            // ExStart:1
            EmailApi   emailApi   = new EmailApi(Common.APP_KEY, Common.APP_SID, Common.BASEPATH);
            StorageApi storageApi = new StorageApi(Common.APP_KEY, Common.APP_SID, Common.BASEPATH);

            String name     = "email_test";
            String fileName = name + ".eml";
            String storage  = "";
            String folder   = "";

            EmailDocument body = new EmailDocument();

            EmailProperties emailProperties = new EmailProperties();

            System.Collections.Generic.List <Link> links             = new System.Collections.Generic.List <Link> {
            };
            System.Collections.Generic.List <EmailProperty> empProps = new System.Collections.Generic.List <EmailProperty> {
            };


            Link link = new Link();

            link.Href  = "http://api.aspose.com/v1.1/pdf/";
            link.Rel   = "self";
            link.Title = "NewField";
            link.Type  = "link";
            links.Add(link);


            EmailProperty emailBody = new EmailProperty();
            EmailProperty emailTo   = new EmailProperty();
            EmailProperty emailFrom = new EmailProperty();

            emailBody.Name  = "Body";
            emailBody.Value = "This is the Body";
            emailBody.Link  = link;
            empProps.Add(emailBody);

            emailTo.Name  = "To";
            emailTo.Value = "*****@*****.**";
            emailTo.Link  = link;
            empProps.Add(emailTo);

            emailFrom.Name  = "From";
            emailFrom.Value = "*****@*****.**";
            emailFrom.Link  = link;
            empProps.Add(emailFrom);


            emailProperties.List = empProps;
            emailProperties.Link = link;

            body.DocumentProperties = emailProperties;
            body.Links = links;

            try
            {
                // Invoke Aspose.Email Cloud SDK API to add new email
                EmailDocumentResponse apiResponse = emailApi.PutCreateNewEmail(fileName, storage, folder, body);

                if (apiResponse != null)
                {
                    Com.Aspose.Storage.Model.ResponseMessage storageRes = storageApi.GetDownload(fileName, null, null);
                    System.IO.File.WriteAllBytes(Common.GetDataDir() + fileName, storageRes.ResponseStream);
                    Console.WriteLine("Add New Email, Done!");
                    Console.ReadKey();
                }
            }
            catch (Exception ex)
            {
                System.Diagnostics.Debug.WriteLine("error:" + ex.Message + "\n" + ex.StackTrace);
            }
            // ExEnd:1
        }