Faxing using Outlook XP and Visual FoxPro 7

D

David

I am trying to send a fax with outlook xp(2002) and Visual FoxPro 7 on
Win98 machine. It works fine when I send an fax attachment in Outlook using
[FAX:555555555] and attaching a tif attachment but when I try it in FoxPro
it comes up with the following error

The e-mail address could not be found. Perhaps the recipient
moved to a different e-mail organization, or there was a mistake in the
address. Check the address and try again.

Here is my testing code

objSession = CreateObject("Mapi.Session")
objSession.Logon ()
MESSAGEBOX("CDO version installed is "+trans(objSession.Version))
objMessage = objSession.Outbox.Messages.Add
objMessage.Subject = "Test"
objMessage.Text = "This is a test with an attachment"

objRecipient = objMessage.Recipients.Add
objRecipient.Name = "[FAX:555555555]" *
objRecipient.Type = 1
objRecipient.Resolve ()
objAttachment = objMessage.Attachments.Add()
objAttachment.Position = 0
objAttachment.Type = 1
objAttachment.ReadFromFile("C:\B.TIF")
objAttachment.Source = "C:\B.TIF"
objAttachment.Name = "C:\B.TIF"


objMessage.Send ()
objSession.Logoff

*Fax number has been changed

David
17/02/2004 09:09:24
 
K

Ken Slovak - [MVP - Outlook]

Why are you setting the Name to the fax address, and not the
Recipient.Address? I'd also suggest using the Recipients.Resolved
property to make sure that the Recipient address is resolved. Also,
things may work better if the fax number is formatted in full
canonical format (using country codes and the + sign, like +1 for the
U.S.).

Also, in secure versions of CDO 1.21 (which is an optional
installation for Office 2000 and later) using Message.Send and
accessing the Recipients collection of the Message object will fire
the security prompts.
 
D

David

Why are you setting the Name to the fax address, and not the
Recipient.Address? I'd also suggest using the Recipients.Resolved
property to make sure that the Recipient address is resolved. Also,
things may work better if the fax number is formatted in full
canonical format (using country codes and the + sign, like +1 for the
U.S.).

Also, in secure versions of CDO 1.21 (which is an optional
installation for Office 2000 and later) using Message.Send and
accessing the Recipients collection of the Message object will fire
the security prompts.


Dear Ken

Thanks for your help. I have given up with CDO 1.21 (I'm using the outlook
object) as I have just been told that we are using only outlook to send
faxes rather than outlook and outlook express (I don't even know whether
CDO 1.21 is supported in Outlook Express, and don't even know whether
Outlook Express sends faxes). I have spent about 4 weeks working on this,
trying to make it work with all the different workstations and servers. I
have just spent about half an hour testing with the outlook object and it
seems to work with everything.

Thanks for your help and also to Russ



David
Anagram Systems
18/02/2004 15:49:41
 
K

Ken Slovak - [MVP - Outlook]

FWIW, Outlook Express doesn't send faxes and doesn't support an
exposed object model. It supports Simple MAPI only. It doesn't support
CDO at all.

Also FWIW, Outlook versions later than Outlook 2000 SR1 will also
restrict access to the Recipients collection and the Send method and
fire security prompts for both. I use Redemption code
(www.dimastr.com/redemption) to avoid that problem.




 
M

MCasebier

Hi All,

I'm working with a MS-Access based Fax automation application that i
experiencing the same issue that was described by David. Everythin
was working fine with Outlook 2000, but will not work with Outloo
2003. There hasn't been any responses to my general pos
(http://www.mcse.ms/showthread.php?s=&threadid=648390) regarding know
issues with Outlook 2003 in this respect so I'm hoping that someon
familiar with this thread has some additional information.

I can programmatically send faxes by using the Outlook objects t
provide the automation; however unlike David I need to maintain
generic level of MAPI compatibility.

I've posted the code that I am working with. I have tried using
Reciepient object (instead of .Recipients.add) as well as usin
either/both the .Name and .Address properties in conjunction with th
.Resolve method to send the fax number. Sending the fax number as th
.Name property seems to get the best results as it is possible to ope
and properly resend the returned message.

Other info:
Windows XP
Access 2000
Outlook 2003
Windows XP Fax

Thanks in advance,
MCasebier


Call SendMail("[FAX:555-5555]", "automated email", "the message text"
True)

Public Function SendMail(Email_To As String, Optional Subject As Strin
= "", Optional MessageText As String = "", Optional ShowDialogYn
False) As Long
'Returns 0 = Success/Non-Zero = Error

On Error GoTo SendMail_Err

Dim RetVal As Long
Dim objOutBox As Object 'MAPIFolder
Dim objNewMessage As Object 'MailItem

'default the return value
RetVal = 0

'objSession is established elsewhere via the following statements
' Set objSession = CreateObject("MAPI.Session")
' objSession.LogOn showdialog:=False, NewSession:=False

'verify that a MAPI session is available
If objSession Is Nothing Then
RetVal = -1
MsgBox "Must LogOn before using the SendMail method."
vbCritical
Else
'use a reference to the outbox to create a new message object
Set objOutBox = objSession.outbox
Set objNewMessage = objOutBox.messages.Add

'add the recepient e-mail address
objNewMessage.Recipients.Add Name:=Email_To, Type:=1

'set the subject and text
objNewMessage.Subject = Subject
objNewMessage.Text = MessageText

'send the email
objNewMessage.Send showdialog:=ShowDialogYn
End If

SendMail_Exit:
SendMail = RetVal
Exit Function

SendMail_Err:
RetVal = Err.Number
Resume SendMail_Exit
End Functio


-
MCasebie
 
M

MCasebier

Wouldn't you know that after weeks of research and a lot of trial an
error, it's not until I take the time to write up a lengthy post that
find a resolution to the issue. It was written up for Outlook 2002
but the fix works for 2003 as well.

OL2002: You Receive an NDR When You Use a Simple MAPI Program to Send
Message
http://tinyurl.com/2fp8y

Thanks,
MCasebie


-
MCasebie
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top