How to supress the outlook pop up message while sending mails in PB8

杀马特。学长 韩版系。学妹 提交于 2021-01-28 10:27:14

问题


I am trying to send mail after doing some operations in PowerBuilder 8. But it pops up an Outlook pop up message asking whether to allow Outlook to send message or not.

Is There any way to bypass this pop up and send mail directly? If the answer is redemption please let me know where to use it in my below code-

//string ls_name
//integer id
ls_name = sle_name.text
id = integer(sle_id.text)

dw_report.Saveas("d:\abc.xls", Excel!, True)


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 = ls_name

mMsg.NoteText = 'Recieved Mail From PB'

mMsg.Recipient[1].name = 'priyadarsini_m01@infosys.com'
//mMsg.AttachmentFile[1].file = 'D:\EB130157\EB130157_22.doc'   

 mMsg.AttachmentFile[1].FileType = mailAttach!
  mMsg.AttachmentFile[1].FileName = 'abc.xls'
  mMsg.AttachmentFile[1].PathName = 'D:\abc.xls'    
  mMsg.AttachmentFile[1].position = 1

//mMsg.Recipient[2].name = 'Shaw, Sue'

// Send the mail

mRet = mSes.mailSend(mMsg)

IF mRet <> mailReturnSuccess! THEN
        MessageBox("Mail Send", 'Mail not sent')
        RETURN

END IF

mSes.mailLogoff()

DESTROY mSes 

回答1:


I believe that is a security setting in Windows/Outlook which is not something you can control from within PowerBuilder.




回答2:


There's a lot of variables in this (e.g. I believe this is different for Exchange server environments compared to direct SMTP), and things have changed over time. There used to be an OLE solution for this called Redemption, although I don't know if it's relevant anymore.

I know I ran into a problem like this recently in Outlook 2010 in an Exchange environment, and the settings here:

Options / Trust Center / Trust Center Settings ... / Programmatic Access

was set to "Warn me about suspicious activity when my antivirus software is inactive or out-of-date", and told me that my user's antivirus was considered out of date. Fixing the antivirus problem made the prompts go away.

Do I think this will solve your problem? Probably not. It's only meant to illustrate that you probably need to broaden your horizons in search of a solution, and that your starting point should probably be Outlook, as opposed to PowerBuilder. (If Microsoft has done its job, there's nothing you can do with any tool to defeat it's security, so you're better off trying to work with it instead of against it.)

Good luck.



来源:https://stackoverflow.com/questions/27312172/how-to-supress-the-outlook-pop-up-message-while-sending-mails-in-pb8

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!