Esempio n. 1
0
        static void Main(string[] args)
        {
            string strPath =
                System.AppDomain.CurrentDomain.BaseDirectory.Replace("\\", "/");

            // Instantiate Object
            APServer.Server server = new APServer.Server();

            // Add an email
            server.AddEMail();

            // Set server information
            // UPDATE THIS LINE WITH YOUR SERRVER INFORMATION
            server.SetSMTPInfo(server: "#.#.#.#", port: 0);
            server.SetSMTPCredentials(
                user: "******",
                domain: "activePDF",
                password: "******");

            // Set email addresses
            server.SetSenderInfo(
                friendlyName: "John Doe",
                address: "*****@*****.**");
            server.SetReplyToInfo(
                friendlyName: "John Doe",
                address: "*****@*****.**");
            server.SetRecipientInfo(
                friendlyName: "Jane Doe",
                address: "*****@*****.**");
            server.AddToCC(
                friendlyName: "Jim Doe",
                address: "*****@*****.**");
            server.AddToBcc(
                friendlyName: "Janice Doe",
                address: "*****@*****.**");

            // Subject and Body
            server.EMailSubject = "PDF Delivery from activePDF";
            server.SetEMailBody(bodyText: "<html><body style='background-color: #EEE; padding: 4px;'>Here is your PDF!</body></html>", isHtml: true);

            // Attachments - Binary attachments can be added with
            // AddEMailBinaryAttachment
            server.AddEMailAttachment($"{strPath}Server.Input.ps");

            // Other email options
            server.EMailReadReceipt  = false;
            server.EMailAttachOutput = true;

            // Convert the PostScript file into PDF
            ServerDK.Results.ServerResult result =
                server.ConvertPSToPDF(
                    PSFile: $"{strPath}Server.Input.ps",
                    PDF: $"{strPath}Server.SendEmail.pdf");

            // Output result
            WriteResult(result);

            // Process Complete
            Console.WriteLine("Done!");
            Console.WriteLine("Press any key to exit.");
            Console.ReadKey();
        }