1. Mitch Goldstein
  2. PowerBuilder
  3. Monday, 27 November 2017 21:02 PM UTC

Hello,

I've recently upgraded to PB 2017.  With11.5 I could open an MailSession and have it use the default Profile with the simple: 

mSes = CREATE mailSession
mRet = mSes.mailLogon(mailNewSession!)
 
Now when I use this, the user gets a popup message asking which profile to use, even if there is only one email profile or the default profile is set.  Secondly, instead of the typical "New Email" window opening where they can edit the To/Subject/Message areas, the address book opens and after selecting an email account the email is automatically sent without providing the ability to edit the email.  How can I can this to work like it did before?
 
TIA,
Mitch Goldstein
Miguel Leeuwee Accepted Answer Pending Moderation
  1. Friday, 1 December 2017 04:47 AM UTC
  2. PowerBuilder
  3. # 1

Try 

 

MailLogon("Default", "")

 

"Default" is my Default email profile, but you can use others.

 

You can get the name of your default profile this way:

//-----------------------

integer li_rc
string ls_key, ls_res, ls_defaultprofile, ls_version
long ll_ret, ll_row, ll_find
 
ii_officeVersion = 0
is_defaultProfile= ""
 
// Try to get the version of Outlook
ls_key = "HKEY_CLASSES_ROOT\Outlook.Application\CurVer"
ll_ret = RegistryGet(ls_key, "", RegString!, ls_version)
if ll_ret = 1 then
    ll_find = lastpos(ls_version, '.')
    ls_version = trim(mid(ls_version, ll_find + 1) + ".0")
    if isNumber(ls_version) then 
        ii_officeversion = integer(ls_version)
    end if
end if
 
if ii_officeVersion = 0 then 
    return -1
elseif ii_officeVersion >= 15 then // Check for existance of Office 2013 and above:
    ls_key = "HKEY_CURRENT_USER\Software\Microsoft\Office\" + ls_version + "\Outlook"
    ll_ret = RegistryGet(ls_key, "DefaultProfile", RegString!, ls_defaultprofile )
    if ll_ret = 1 and len(ls_defaultProfile) > 0 then
        is_defaultProfile = ls_defaultProfile
        RETURN 1 // Done. We found it
    else
        RETURN -2 // we should have found it, but we didn't
    end if
elseif ii_officeVersion < 15 then // Check for existance of Office 97-2010:
    ls_key = "HKEY_CURRENT_USER\Software\Microsoft\windows NT\currentversion\Windows Messaging Subsystem\Profiles"
    ll_ret = RegistryGet(ls_key, "DefaultProfile", RegString!, ls_defaultProfile )
    if ll_ret = 1 and len(ls_defaultProfile) > 0 then
        is_defaultProfile = ls_defaultProfile
        RETURN 2 // Done. We found it
    else
        RETURN -3 // we should have found it, but we didn't
    end if
end if
 
RETURN -1 // not found
 
Comment
  1. Miguel Leeuwee
  2. Friday, 1 December 2017 04:50 AM UTC
Forgot to mention that we do something like this:



MailSession mses



mses = Create MailSession



if is_res > "" then



mRet = mSes.mailLogon(is_res, "") //, MailNewSession!)



IF mRet > mailReturnSuccess! THEN



   messagebox("Information", "Failed! About to try without Profile.", information!)



   mSes.mailLogon() // try without profile ..



end if

  1. Helpful
  1. Mitch Goldstein
  2. Friday, 8 December 2017 21:52 PM UTC
Miguel,



Do your users use Outlook?  If so, what happens when you send the email?  Does it display the edit screen so they can modify the body and subject?  That's what happened in prior versions of PB.



Thanks,



Mitch

  1. Helpful
There are no comments made yet.
Roland Smith Accepted Answer Pending Moderation
  1. Tuesday, 28 November 2017 04:12 AM UTC
  2. PowerBuilder
  3. # 2

As of 12.6 it defaults to Extended MAPI which is slightly different than the older Simple MAPI.

You can tell it to use Simple MAPI. See this thread:  https://community.appeon.com/index.php/qna/q-a/mailsession-with-simple-mapi

Comment
There are no comments made yet.
Govinda Lopez @Appeon Accepted Answer Pending Moderation
  1. Tuesday, 28 November 2017 00:47 AM UTC
  2. PowerBuilder
  3. # 3

Hi Mitch,

 

Maybe you can take a look at Roland Smith's suggestion: http://www.topwizprogramming.com/pbnismtp.html

 

 

Regards,

Comment
  1. Mitch Goldstein
  2. Friday, 8 December 2017 21:20 PM UTC
Thanks for the reply.  I'm trying to avoid our clients having to enter their smtp settings.  It would be a support nightmare for our very non-technical users.

  1. Helpful
There are no comments made yet.
  • Page :
  • 1


There are no replies made for this question yet.
However, you are not allowed to reply to this question.