Сторонний разработчик efax (efaxdeveloper.com) не может отправить вложение по электронной почте - PullRequest
0 голосов
/ 15 марта 2019

Для моего приложения .NET C # я использую стороннее программное обеспечение для электронной факсимильной связи с именем efaxdeveloper.com

Я могу успешно отправлять электронную почту / факсы на почтовый ящик со следующим кодом:

            OutboundClient outboundClient = new OutboundClient();
                               outboundClient.AccountId = "484894774";
            outboundClient.UserName = "blahUserNameblah";
            outboundClient.Password = "blahPasswordblah";

OutboundRequest outboundRequest = new OutboundRequest();
outboundRequest.TransmissionControl.FaxHeader = "Test Company Test";

            outboundRequest.Recipient.RecipientName = "John Doe";
            outboundRequest.Recipient.RecipientCompany = "Company ABC Inc.";
            outboundRequest.Recipient.RecipientFax = "15551234567";

            // E) add file(s) to fax //////////////////////////////////////////////////////////////////
            FaxFile faxFile1 = new FaxFile();

            //faxFile1.FileType = FaxFileType.txt;
            //faxFile1.FileContents = Encoding.ASCII.GetBytes("Fax document");


            //faxFile1.FileType = FaxFileType.pdf;

            string faxfilepath = "E:\\blah\\bibleVerses.txt";
            faxFile1.FileType = FaxFileType.txt;
            faxFile1.FileContents = File.ReadAllBytes(faxfilepath);
            outboundRequest.Files.Add(faxFile1);

            outboundRequest.TransmissionControl.TransmissionID = string.Format("WebTest-{0}", Guid.NewGuid()).Substring(0, 15);




            // set the disposition level 
            outboundRequest.DispositionControl.DispositionLevel = DispositionLevel.Both;
            // set the disposition method
            outboundRequest.DispositionControl.DispositionMethod = DispositionMethod.Email;
            // for DispositionMethod.Email set the email address(es) to send the disposition to
            outboundRequest.DispositionControl.DispositionEmails.Add(
                new DispositionEmail { DispositionAddress = "blah@blah.com", DispositionRecipient = "John Doe" });

            // G) send the oubound fax to efaxDeveloper and get an instance of OutboundResponse back 
            OutboundResponse outboundResponse = outboundClient.SendOutboundRequest(outboundRequest);

            // check if the fax was accepted successfuly
            if (outboundResponse.StatusCode == StatusCode.Success)
            {
                Console.WriteLine(string.Format("Success: DOCID {0} TransmissionID {1}", outboundResponse.DOCID, outboundResponse.TransmissionID));
            }
            else
            {
                Console.WriteLine(string.Format("Error: {0} {1}", outboundResponse.ErrorMessage, outboundResponse.ErrorLevel));
            }

К счастью, вышеупомянутый код отправляет электронное письмо на адрес электронной почты назначения.Однако указанный вложенный файл («E: \ blah \ bibleVerses.txt») не отображается в целевом электронном письме.StatusCode.Success успешно выходит, но вложение не достигает места назначения, даже если электронная почта это делает.Может кто-нибудь показать мне, какие изменения кода мне нужно будет сделать, чтобы файл был прикреплен к факсу?

...