如何生成传真并以代码形式发送

发布于 2024-07-24 09:32:05 字数 423 浏览 9 评论 0原文

我有一个业务需求,需要生成传真并将其发送给收件人。 我知道收件人姓名和传真号码,并且将附上一份 PDF。 该流程每天都会运行,每次包含 100 条要处理的记录。 我的印象是,这可以通过向传真机发送电子邮件来完成,并且在 Outlook 中进行快速测试效果很好。 但是,如果我尝试在代码中执行相同的操作,则会收到有关邮件地址无效的错误。

MailMessage msg = new MailMessage();
msg.To.Add(new MailAddress("[Fax:myUser@5555555555]"));

通过代码发送传真有哪些选项? (.NET) 这些传真本质上是机密...


编辑信息

我的公司确实使用 Right Fax。

I have a business requirement to generate a fax and send it to the recipient. I know the recipients name and fax number and there is a PDF that will be attached. This process will run daily and consist of 100 records to process each time. I was under the impression that this could be done by sending an email to the fax machine and a quick test in Outlook worked just fine. However, if I were to try and do the same thing in code, I get an error about the mail address being invalid.

MailMessage msg = new MailMessage();
msg.To.Add(new MailAddress("[Fax:myUser@5555555555]"));

What are my options for sending faxes from code? (.NET) These faxes are confidential in nature...


EDITED INFO

My company does use Right Fax.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

半暖夏伤 2024-07-31 09:32:05

这是一些可能有帮助的代码。 这是使用 Right Fax COM API 库 (rfcomapi.dll)

RFCOMAPILib.FaxServerClass faxserver = new RFCOMAPILib.FaxServerClass();
faxserver.ServerName = "ServerName";
faxserver.Protocol = RFCOMAPILib.CommunicationProtocolType.cpNamedPipes;
faxserver.UseNTAuthentication = RFCOMAPILib.BoolType.True;
faxserver.OpenServer();

RFCOMAPILib.Fax fax = (RFCOMAPILib.Fax) faxserver.get_CreateObject(RFCOMAPILib.CreateObjectType.coFax);

// set up your 'fax' object the way you want it, below is just some sample options
fax.ToName = "John Doe";
fax.ToFaxNumber = "4255551111";
fax.ToVoiceNumber = "4255550000";
fax.ToCompany = "ACME";
fax.FromName = "My Company";
fax.FromVoiceNumber = "4255552222";

fax.Send();

Here is some code that may help. This is using the Right Fax COM API Library (rfcomapi.dll)

RFCOMAPILib.FaxServerClass faxserver = new RFCOMAPILib.FaxServerClass();
faxserver.ServerName = "ServerName";
faxserver.Protocol = RFCOMAPILib.CommunicationProtocolType.cpNamedPipes;
faxserver.UseNTAuthentication = RFCOMAPILib.BoolType.True;
faxserver.OpenServer();

RFCOMAPILib.Fax fax = (RFCOMAPILib.Fax) faxserver.get_CreateObject(RFCOMAPILib.CreateObjectType.coFax);

// set up your 'fax' object the way you want it, below is just some sample options
fax.ToName = "John Doe";
fax.ToFaxNumber = "4255551111";
fax.ToVoiceNumber = "4255550000";
fax.ToCompany = "ACME";
fax.FromName = "My Company";
fax.FromVoiceNumber = "4255552222";

fax.Send();
意中人 2024-07-31 09:32:05

我们使用 RightFax dll。 不过,只有当您的网络上有 RightFax 时,这才有效。

We use the RightFax dll. That will only work if you have RightFax on your network though.

滥情稳全场 2024-07-31 09:32:05

您可以使用 Microsoft 传真服务,但需要设置传真服务器。Google 搜索应返回一些示例。

添加对 Interop.FAXCOMLib.dll 的引用

这是一个示例 (vb.net):

    Dim fs As FAXCOMLib.FaxServer
    Dim fd As FAXCOMLib.FaxDoc
    Dim result As Integer

    fs = New FAXCOMLib.FaxServer()
    fs.Connect("FaxServer1")

    fd = CType(fs.CreateDocument("c:\documenttofax.pdf"), FAXCOMLib.FaxDoc)
    fd.RecipientName = "John Doe"
    fd.FaxNumber = "555-1234"

    Try
       result = fd.Send()
    Finally
        fs.Disconnect()
    End Try

You can use the Microsoft Fax Service, but you will need to set up a fax server.. A Google search should return some examples.

Add a reference to Interop.FAXCOMLib.dll

Here's an example (vb.net):

    Dim fs As FAXCOMLib.FaxServer
    Dim fd As FAXCOMLib.FaxDoc
    Dim result As Integer

    fs = New FAXCOMLib.FaxServer()
    fs.Connect("FaxServer1")

    fd = CType(fs.CreateDocument("c:\documenttofax.pdf"), FAXCOMLib.FaxDoc)
    fd.RecipientName = "John Doe"
    fd.FaxNumber = "555-1234"

    Try
       result = fd.Send()
    Finally
        fs.Disconnect()
    End Try
情徒 2024-07-31 09:32:05

您还可以使用 eFax,在这种情况下,您可以通过电子邮件将 PDF(传真文档)发送到 eFax,他们会为您传真! 它们非常便宜。

You can also use eFax in which case you email a PDF (the faxed document) to eFax and they will fax it for you! They are very cheap.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文