Solved

How to prevent Outlook from popping up the address booking when sending an email via Powerbuilder

Posted on 2004-08-27
8
636 Views
Last Modified: 2013-12-26
Hello everyone,

When I connect to Outlook to send an email it pops up the address book even though I am specifying the emails correctly.

Is there a way to prevent this?

Here is my current code:

mailSession mSes

mailReturnCode mRet
mailMessage mMsg
mailFileDescription mAttach

//mMsg.Recipient[1].Address = 'paulericmurray@hotmail.com'
mMsg.Recipient[1].name = 'paulericmurray@hotmail.com'
mMsg.Recipient[1].RecipientType = mailTo!
//mMsg.Recipient[2].Address = 'pemurray@groundtravel.com'
mMsg.Recipient[2].name = 'pemurray@groundtravel.com'
mMsg.Recipient[2].RecipientType      = mailCC!

mAttach.Filename = 'Apollo.doc'
mAttach.Pathname = 'T:\Apollo.doc'
mAttach.FileType = mailAttach!
//mAttach.Position = 1

mMsg.Subject = 'Test Message'
mMsg.NoteText = 'This is the body of mail ~nAuto Generated E-mail by the system'


// Create a mail session
mSes = CREATE mailSession
// Log on to the session
//mRet = mSes.mailLogon(mailNewSession!)

mRet = mSes.mailLogon()
IF mRet <> mailReturnSuccess! THEN
     MessageBox("Mail", 'Logon failed.')
     RETURN
END IF

mMsg.AttachmentFile[1] = mAttach
IF mRet <> mailReturnSuccess! THEN
     MessageBox("Mail", 'Attachment failed.')
     RETURN
END IF


mRet = mSes.mailAddress(mMsg)
IF mRet <> mailReturnSuccess! THEN
     MessageBox("Mail", 'Addressing failed.')
     RETURN
END IF

// Send the mail
mRet = mSes.mailSend(mMsg)
IF mRet <> mailReturnSuccess! THEN
     MessageBox("Mail", 'Sending mail failed.')
        MessageBox("Mail", String(mRet))

string mailreturnstring
        
        mailreturnstring = MailErrorToString(mRet)
        MessageBox("Email Result", "Email ReturnCode = " + mailreturnstring)
     RETURN
END IF

mSes.mailLogoff()
DESTROY mSes


Thank you in advance for your help.

Paul
0
Comment
Question by:pemurray
  • 4
8 Comments
 
LVL 4

Accepted Solution

by:
falvaro3 earned 400 total points
Comment Utility
With the recipient object of the mailitem, try using the Resolve() method to resolve the address before sending.

mMsg.Recipient[1].name = 'paulericmurray@hotmail.com'
mMsg.Recipient[1].RecipientType = mailTo!
IF NOT mMsg.Recipient[1].Resolve THEN
    // Do something about the unresolvable (?) address
END IF
mMsg.Recipient[2].name = 'pemurray@groundtravel.com'
mMsg.Recipient[2].RecipientType     = mailCC!
IF NOT mMsg.Recipient[2].Resolve THEN
    // Do something about the unresolvable (?) address
END IF

hth,
frank
0
 
LVL 4

Expert Comment

by:falvaro3
Comment Utility
whoopsie.  my bad.  I was using the Recipient object from the Outlook object model (which contains the Resolve() method to resolve addresses from the address book).  Sorry about that (unless, of course, you'd want to do it that way... ;).
0
 
LVL 4

Expert Comment

by:falvaro3
Comment Utility
There is, however, a mailResolveRecipient() PowerScript method of the mailSession object in Powerbuilder which resolves usernames.  Not sure if it resolves qualified addresses, though.
0
 
LVL 4

Expert Comment

by:falvaro3
Comment Utility
I would lean toward my 8/30/2004 comment as a possible suggestion for a solution, since the code was dealing with the mailSession object in PB, and the mailResolveRecipient() is a valid method of that object.
I would like to hear from the original poster first, of course.
10-q, fa
0
 

Author Comment

by:pemurray
Comment Utility
Sorry, I was sure that I tried that but I will check it out again tonight.  Thank you, Paul
0

Featured Post

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

Suggested Solutions

In our object-oriented world the class is a minimal unit, a brick for constructing our applications. It is an abstraction and we know well how to use it. In well-designed software we are not usually interested in knowing how objects look in memory. …
Programmer's Notepad is, one of the best free text editing tools available, simply because the developers appear to have second-guessed every weird problem or issue a programmer is likely to run into. One of these problems is selecting and deleti…
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
The viewer will learn how to synchronize PHP projects with a remote server in NetBeans IDE 8.0 for Windows.

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now