To send email from within powerbuilder version 7

I am trying to do it first time.

I want to send email from pb7 to Outlook Express

I am trying this via a command button.

mailSession mSes
mailReturnCode mRet
mailMessage mMsg

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

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

// Populate the mailMessage structure

mMsg.Subject = 'From Within Powerbuilder'
mMsg.NoteText = 'Luncheon at 12:15'
mMsg.Recipient[1].name = 'mrashid'
mMsg.Recipient[1].address  = "mrashid@siddiqsons.com"

// Send the mail

mRet = mSes.mailSend(mMsg)

IF mRet <> mailReturnSuccess! THEN
            MessageBox("Mail Send", 'Mail not sent')
            RETURN
END IF
mSes.mailLogoff()
DESTROY mSes

First a Choose Profile pop up box comes.  There in the profile name "Outlook" is written. I dont want this pop up box intermediate.

After pressing ok a new pop up box comes and it says
" a program is trying to automatically send email on your behalf. Do you want to allow this. If this is unexpected , it may be a virus and you should choose no"

I choose yes.

I do not want those two pop boxes to come and ask user response.
There is no error message and yet the email has not been delivered.

Please help.
MateenAsked:
Who is Participating?
 
sandeep_patelCommented:
Hi,

I think first you need to configure your Outlook and make Outlook as your default mail client. Then it will not ask for the profiles to select.

Regards,
Sandeep
0
 
sandeep_patelCommented:
Also try to send mail directly from outlook. If it fails then it's problem with configuration of outlook.

Sandeep
0
 
diasroshanCommented:
0
 
MateenAuthor Commented:
Hi,

The mail is being sent now. The only problem is that it asks
  " A program is attempting to send email on your behalf"
I want to suppress this intermediate question. What is the exact configuration place to stop that.
0
 
MateenAuthor Commented:
Ok,

I should explore outlook redemption.

0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.