Hello,
We have been using the next code to send email in PB 9 without problem for a long time:
(Really, this is you a very reduced version of our code, but we have the same problems with the complete code and this is easier to manage and explain. In any case, at the end we enclose the complete code in case it can be helpful to the resolution of the issue.)
////////////////////*********************REDUCED CODE******************************************///////////////////////////////
mailSession lms_Ses
mailMessage lmm_mensaje
mailReturnCode mrc_abierta,lmrc_enviado,lmrc_cerrada
MessageBox("Email OUTLOOK", "CREATE mailSession")
lms_Ses=CREATE mailSession
MessageBox("Email OUTLOOK", "lms_Ses.mailLogon")
mrc_abierta=lms_Ses.mailLogon()
//mrc_abierta=lms_Ses.mailLogon(mailNewSession!) //We have tried this option too, but we get the same return
if mrc_abierta=mailReturnLoginFailure! then
MessageBox("Email OUTLOOK", 'lms_Ses.mailLogon mailReturnLoginFailure!')
return -1
elseif mrc_abierta=mailReturnInsufficientMemory! then
MessageBox("Email OUTLOOK", 'lms_Ses.mailLogon mailReturnInsufficientMemory!')
return -1
elseif mrc_abierta <> mailReturnSuccess! THEN
MessageBox("Email OUTLOOK", 'lms_Ses.mailLogon Logon failed')
return -1
end if
lmm_mensaje.Subject='Subject'
lmm_mensaje.NoteText='Text'
lmm_mensaje.recipient[1].name='Name' //We have tried without this option too, but we get the same return. In 32-bit displays the Address dialog box
lmm_mensaje.recipient[1].address ='xxxx@at4wireless.com' //we have used a valid email here
lmm_mensaje.recipient[1].RecipientType=mailTo! //We have tried without this option too, but we get the same return
MessageBox("Email OUTLOOK", "lms_Ses.MailSend before")
lmrc_enviado=lms_Ses.MailSend(lmm_mensaje) ///<<<-----------HERE IS WHERE WE GET THE ERROR IN 64-bit
MessageBox("Email OUTLOOK", "lms_Ses.MailSend after")
if lmrc_enviado=mailReturnInsufficientMemory! then
MessageBox("Email OUTLOOK", "mailReturnFailure!")
DESTROY lms_Ses
Return -2
elseif lmrc_enviado=mailReturnFailure! then
MessageBox("Email OUTLOOK", "mailReturnFailure!")
DESTROY lms_Ses
RETURN -2
elseif lmrc_enviado=mailReturnLoginFailure! then
MessageBox("Email OUTLOOK", "mailReturnLoginFailure!")
DESTROY lms_Ses
RETURN -2
elseif lmrc_enviado=mailReturnUserAbort! then
MessageBox("Email OUTLOOK", "mailReturnUserAbort!")
DESTROY lms_Ses
RETURN -2
elseif lmrc_enviado=mailReturnDiskFull! then
MessageBox("Email OUTLOOK", "mailReturnDiskFull!")
DESTROY lms_Ses
RETURN -2
elseif lmrc_enviado=mailReturnTooManySessions! then
MessageBox("Email OUTLOOK", "mailReturnTooManySessions!")
DESTROY lms_Ses
RETURN -2
elseif lmrc_enviado=mailReturnTooManyFiles! then
MessageBox("Email OUTLOOK", "mailReturnTooManyFiles!")
DESTROY lms_Ses
RETURN -2
elseif lmrc_enviado=mailReturnTooManyRecipients! then
MessageBox("Email OUTLOOK", "mailReturnTooManyRecipients!")
DESTROY lms_Ses
RETURN -2
elseif lmrc_enviado=mailReturnUnknownRecipient! then
MessageBox("Email OUTLOOK", "mailReturnUnknownRecipient!")
DESTROY lms_Ses
RETURN -2
elseif lmrc_enviado=mailReturnAttachmentNotFound! then
MessageBox("Email OUTLOOK", "mailReturnAttachmentNotFound!")
DESTROY lms_Ses
RETURN -2
elseif lmrc_enviado<>mailReturnSuccess! THEN
MessageBox("Email OUTLOOK", "OTHER ERROR")
DESTROY lms_Ses
RETURN -2
END IF
MessageBox("Email OUTLOOK", "lms_Ses.maillogoff")
lmrc_cerrada=lms_Ses.maillogoff()
IF lmrc_cerrada<>mailReturnSuccess! THEN
MessageBox("Email OUTLOOK", "lms_Ses.maillogoff ERROR")
DESTROY lms_Ses
RETURN -3
END IF
DESTROY lms_Ses
RETURN 1
////////////////////******************************************************************************///////////////////////////////
Now we have migrated to PB 12.6. Build 4091
If we run the same code in the PowerBuilder 12.6 Classic IDE (the project runs as a 32-bit application), it is working without problem, we can send emails.
If we build a 32-bit application, at runtime when we deploy the application, the same code is working without problem, we can send emails.
If we build a 64-bit application, at runtime when we deploy the application (the only way to test 64-bit features), we have problem with MailSend function.
There are two different behaviors depending on whether we use Extended MAPI or Simple MAPI.
If we use Simple MAPI, statement lmrc_enviado=lms_Ses.MailSend(lmm_mensaje) always returns mailReturnFailure! and email is not sent.
To use Simple MAPI, we have created a text file named pb.ini with the text
[PB]
UseSimpleMAPI=yes
and deploy it with our application executable. We follow the instructions in http://scn.sap.com/community/developer-center/powerbuilder/blog/2015/03/20/powerbuilder-126-and-extended-mapi
If we use Extended MAPI (we don´t deploy pb.ini with our application executable), statement lmrc_enviado=lms_Ses.MailSend(lmm_mensaje) generates a runtime error and the application exits (and email is not sent).
In order to create 64-bit native applications in PowerBuilder Classic, we have followed all the instructions in powerbuilder help (http://help.sap.com/saphelp_pb126/helpdata/en/2f/8c548ab5781014944b973cfbb2dec1/content.htm?frameset=/en/2f/8c548ab5781014944b973cfbb2dec1/frameset.htmcurrent_toc=/en/2f/16f291b5781014af9ce45f1ca8d7d2/plain.htmnode_id=12)
That is, we have selected the platform 64-bit in the Project painter General tab. As we need to deliver both 32-bit and 64-bit versions of our application, we have used separate projects and separate folders for the deployed output.
we have followed all the system requirements.
To run 32-bit application version:
Windows 7 Professional Service pack 1 64 bits
PowerBuilder 12.6 32-bit system files
Microsoft Outlook client 2007 (12.0.6744.500) 32 bits
To run 64-bit application version:
Windows 7 Professional Service pack 1 64 bits
PowerBuilder 12.6 64-bit system files
Microsoft Outlook client 2010 (14.0.7166.5000) 64 bits
Please, if you need further details, do not hesitate to ask us. It is very important for us to have our 64-bit application as soon as possible.
Thanks in advance for your help!
Note. We have tried to open the incident through the SAP platform (137923/2016), but we are having many problems with the platform and the incidence is still NOT SENT TO SAP status and received no response, and it is an very urgent issue for us.