- Scott Gorke
- PowerBuilder
- Wednesday, 17 November 2021 05:57 PM UTC
We have a 24/7 PB2019R2 app that pulls records off a queue table, saves some data in a PowerSoft Report format (<filename>.PSR), then calls this code to email the PSR file as an attachment. Problem is at one client, the call to log off the mail session hangs. This doesn't seem to happen anywhere else. Any ideas on what to do from here? Thanks in advance...
<.......Call function - pass in the recipient's email address.......>
str_mail lstr_mail
mailRecipient mrecip
<.......Generate PSR file.......>
//Establish an instance of the Mail Session object, and log on
lstr_mail.mSes = create mailSession
lstr_mail.mRet = lstr_mail.mSes.mailLogon () //here, we have an instance of MS Outlook running alongside our 24/7 app
if lstr_mail.mRet <> mailReturnSuccess! then
f_logoff_mail(lstr_mail.mSes )
return 3
end if
// Attach PSR File to mail message
lstr_mail.mAttach.FileType = mailAttach!
lstr_mail.mAttach.PathName = ls_filename
lstr_mail.mAttach.FileName = ls_filename
lstr_mail.mMsg.Subject = <.......subject.......>
lstr_mail.mMsg.NoteText = " "
lstr_mail.mAttach.Position = len(lstr_mail.mMsg.NoteText)-1
lstr_mail.mMsg.AttachmentFile[1] = lstr_mail.mAttach
mrecip.Name = as_address
lstr_mail.mRet = lstr_mail.mSes.MailResolveRecipient(mrecip)
if lstr_mail.mRet <> mailReturnSuccess! then
f_logoff_mail(lstr_mail.mSes )
return 4
end if
lstr_mail.mMsg.Recipient[1] = mrecip
lstr_mail.mRet = lstr_mail.mSes.Mailsend( lstr_mail.mMsg )
if lstr_mail.mRet <> mailReturnSuccess! then
f_logoff_mail(lstr_mail.mSes )
return 5
end if
// destroys mail session
lstr_mail.mSes.mailLogoff ( ) //HANGS HERE
<.......>
return 1
Find Questions by Tag
Helpful?
If a reply or comment is helpful for you, please don’t hesitate to click the Helpful button. This action is further confirmation of their invaluable contribution to the Appeon Community.