pemurray
asked on
How to prevent Outlook from popping up the address booking when sending an email via Powerbuilder
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].Addres s = 'paulericmurray@hotmail.co m'
mMsg.Recipient[1].name = 'paulericmurray@hotmail.co m'
mMsg.Recipient[1].Recipien tType = mailTo!
//mMsg.Recipient[2].Addres s = 'pemurray@groundtravel.com '
mMsg.Recipient[2].name = 'pemurray@groundtravel.com '
mMsg.Recipient[2].Recipien tType = 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(mailNewSess ion!)
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
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].Addres
mMsg.Recipient[1].name = 'paulericmurray@hotmail.co
mMsg.Recipient[1].Recipien
//mMsg.Recipient[2].Addres
mMsg.Recipient[2].name = 'pemurray@groundtravel.com
mMsg.Recipient[2].Recipien
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(mailNewSess
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
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
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... ;).
There is, however, a mailResolveRecipient() PowerScript method of the mailSession object in Powerbuilder which resolves usernames. Not sure if it resolves qualified addresses, though.
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
I would like to hear from the original poster first, of course.
10-q, fa
ASKER
Sorry, I was sure that I tried that but I will check it out again tonight. Thank you, Paul