Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Send Fax by VFP
Message
General information
Forum:
Visual FoxPro
Category:
ActiveX controls in VFP
Title:
Miscellaneous
Thread ID:
00832948
Message ID:
00832985
Views:
20
>> sending a fax from VFP

Let's see.. I haven't done this for a while but you could do it if you had an available login for a messaging client, such as Outlook, that understands faxing with a MAPI-compliant fax service appropriately set up in the e-mail client.

Something like this probably still works -- see disclaimer after code sample :
* get a handle to a MAPI session:
oSession = CREATEOBJECT("Mapi.Session")
oSession.Logon("My Profile", .F.) && don't show dialog box

* create a new message
oMessage = oSession.OutBox.Messages.Add()
* if you need to grab this message later, you'll want
* to save its ID, which will remain constant when
* it moves out of the Outbox:
* oMessage.ID -- put it in a log or something

* now you have to create a message recipient,
* and tell MAPI it's of "fax type":

oRecipient = oMessage.Recipients.Add()

WITH oRecipient
   .Name = "MyRecipient"
   .Address = "FAX:Whomever@999-9999"
   .AddressEntry.Type = "FAX"
   .AddressEntry.Address = "Whomever@999-9999"
ENDWITH

* In this example, you've got the fax number and
* other address information, and you're transfering
* it to the message explicitly.
* It's also possible to give just the name
* and tell Outlook to resolve the address if
* you know that all your recipients are resolvable
* in the existing addressbook.

* Now add some content:

oMessage.Text = "here is my file..."
oAttach = oMessage.Attachments.Add()

WITH oAttach
   .Name = <pathed filename>
   .Type = 2 && link rather than embed
   .Source = <pathed filename>
ENDWITH

* the following saves the message information
* to the physical message in the message store:

oMessage.Update()

* now you can send the message:

oMessage.Send(.T., .F.)  && save a copy, don't show dialog
Note that I haven't done this with recent versions of MAPI, and that recent security patches have probably made this a bit more difficult to do (in terms of what Outlook and other messaging clients will allow, depending on how configured, when you're talking about control by other apps such as VFP).

But the above is still the general idea of how you would do it.

There are additional methods, such as fax drivers if you're driving the printed output from VFP. But if all you want to do is attach an existing file, this is probably the easiest way.


>L<
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform