Solved

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

Posted on 2004-08-27
8
645 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
ID: 11930761
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
ID: 11930850
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
ID: 11930878
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
ID: 12173613
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
ID: 12173935
Sorry, I was sure that I tried that but I will check it out again tonight.  Thank you, Paul
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

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. …
How to install Selenium IDE and loops for quick automated testing. Get Selenium IDE from http://seleniumhq.org Go to that link and select download selenium in the right hand columnThat will then direct you to their download page.From that page s…
The viewer will learn how to use NetBeans IDE 8.0 for Windows to connect to a MySQL database. Open Services Panel: Create a new connection using New Connection Wizard: Create a test database called eetutorial: Create a new test tabel called ee…
The viewer will learn how to use and create new code templates in NetBeans IDE 8.0 for Windows.

914 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

21 Experts available now in Live!

Get 1:1 Help Now