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