Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

SQL Mail can't find MAPI Profile

219 views
Skip to first unread message

David Jung

unread,
Nov 1, 2001, 7:16:57 PM11/1/01
to
We're trying to enable SQL Mail on one of SQL 2K servers running on Win2K
Server. Everytime we try to assign the profile name to SQL Mail's
configuration and click Test, we get "Successfully started (and stopped) a
MAPI session with this profile." We click OK on that dialog box, then we
press OK on the SQL Mail Configuration dialog box and we get the error that
"This MAPI profile was not found on the server. Are you sure this is what
you want?". We press "Yes".

We've checked the KB files on this and also walked through all the steps
outlined in Q263556 and we're still gettting this problem.

We can send e-mail via Outlook 2000 so it appears not to be our Outlook /
Exchange configuration.

All the services that are suppose to be running for SQL mail are running.

Any assistance would be appreciated.

Thanks
David


Vishal Anand[MS]

unread,
Nov 2, 2001, 1:37:47 PM11/2/01
to
Hi,
Check the Outlook profile. Is it the same mentiond in the SQL Mail
Configuration?

Regards
Vishal Anand
Microsoft SQL Server Support


Of course, this posting wouldn't be complete without a nice, juicy
disclaimer from our lawyers: This posting is provided "AS IS" with no
warranties, and confers no rights. You assume all risk for your use. © 2001
Microsoft Corporation. All rights reserved.

--------------------
| From: "David Jung" <david...@mullinconsulting.com>
| Subject: SQL Mail can't find MAPI Profile
| Date: Thu, 1 Nov 2001 16:16:57 -0800
| Lines: 22
| X-Priority: 3
| X-MSMail-Priority: Normal
| X-Newsreader: Microsoft Outlook Express 6.00.2600.0000
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000
| Message-ID: <O0MP1OzYBHA.2052@tkmsftngp02>
| Newsgroups: microsoft.public.sqlserver.tools
| NNTP-Posting-Host: 63.150.114.2
| Path: cppssbbsa01.microsoft.com!tkmsftngp01!tkmsftngp02
| Xref: cppssbbsa01.microsoft.com microsoft.public.sqlserver.tools:8057
| X-Tomcat-NG: microsoft.public.sqlserver.tools

David Jung

unread,
Nov 2, 2001, 8:25:16 PM11/2/01
to
Greetings. Yes, the Outlook Profile is the same one mentioned in SQL Mail's
config.

When we click the drop-down listbox in the SQL Mail config, there aren't any
profiles listed. Is this normal? Can this be any indication that something
else (like a service) is misconfigured preventing SQL from seeing the
profile?

Thanks

David

"Vishal Anand[MS]" <vishala...@microsoft.com> wrote in message
news:zbYRA28...@cppssbbsa01.microsoft.com...

Tony Bain

unread,
Nov 4, 2001, 1:50:22 PM11/4/01
to
Open the Internet Explorer properties window (right click the IE icon on the
desktop), choose the program tab and ensure that Outlook is selected for
email instead of Outlook Express. Restart SQL after you have changed this
if outlook express was selected. This can cause problems similar to those
you are experiencing.

Regards
Tony Bain
www.sqlserver.co.nz

"David Jung" <david...@mullinconsulting.com> wrote in message
news:efP90ZAZBHA.1220@tkmsftngp03...

Tibor Karaszi

unread,
Nov 5, 2001, 2:37:43 AM11/5/01
to
Obvious questions, but:

1. Did you create the mail profiles while logged in as the same Windows user as your SQL Server
services are using?

2. Are SQL Server and Agent using the same Windows account?

--
Tibor Karaszi, SQL Server MVP
Archive at: http://groups.google.com/groups?oi=djq&as_ugroup=microsoft.public.sqlserver

"David Jung" <david...@mullinconsulting.com> wrote in message

news:O0MP1OzYBHA.2052@tkmsftngp02...

David Jung

unread,
Nov 9, 2001, 7:33:14 PM11/9/01
to
Thanks for the suggestion. Unfortunately, the settings were already set the
way you described.

Any other suggestions would be greatly appreciated.

Thanks
David

"Tony Bain" <to...@sqlserver.co.nz> wrote in message
news:#z6jAGWZBHA.224@tkmsftngp07...

David Jung

unread,
Nov 9, 2001, 7:37:57 PM11/9/01
to
> 1. Did you create the mail profiles while logged in as the same Windows
user as your SQL Server
> services are using?

Hmm...I don't recall if I did or not. I'll try it again.

> 2. Are SQL Server and Agent using the same Windows account?

Yes...they are using the same Windows account.

Thanks
David


Matt House

unread,
Nov 14, 2001, 5:51:31 PM11/14/01
to
I've had similar problems with SQL 7.0. It appears that in order for SQL
Server Agent Mail Session to work, you must start the MSSQL Server service
with the same account that the mail profile is configured with. However,
doing this seems to break the xp_sendmail extended stored procedure, causing
any command using this is hang indefinately. MS has at least one article of
interest (Q136869) that talks about starting SQL Server from the command
line using sqlservr -c. This seemed to work for me, but it is not really a
permanent fix.

Matt


"David Jung" <david...@mullinconsulting.com> wrote in message

news:#yzVGBYaBHA.1908@tkmsftngp03...

Richard Waymire [MS]

unread,
Nov 18, 2001, 1:29:39 PM11/18/01
to
no - the agent mail configuration is completely independent from the SQL
Server mail configuration.

--
Richard Waymire, MCT, MCSE, MCDBA

I've been "encouraged" to share this helpful information from our lawyers.


This posting is provided "AS IS" with no warranties, and confers no rights.
You assume all risk for your use. © 2001 Microsoft Corporation. All rights
reserved.

"Matt House" <mho...@lmi.org> wrote in message
news:#LP9y7VbBHA.1856@tkmsftngp05...

Matt House

unread,
Nov 29, 2001, 1:20:45 PM11/29/01
to
Thanks to Narayana Vyas Kondreddi for leading me in the right direction....

Article Q263556 contains a very detailed description of SQL Mail in SQL
Server version 6.5, 7.0 and 2000. In addition to the standard answers on
how to fix xp_sendmail problems, it includes a brief description of SQL
Mail's interaction with the Outlook Security Patch (version 9.0.0.4201). On
SQL 7.0, SQL Mail will not work on a machine that has the Outlook Security
Patch installed!

Check Q263297 for information on how to specify exception rules in Exchange
that will allow SQL Mail to run. I made the changes described and finally
was able to get xp_sendmail to work. It's unfortunate that so many people
have posted descriptions of the same or similar problems in SQL Mail 7.0,
and yet the answer was fairly well hidden.

Let me know if this works.

Matt

"Matt House" <mho...@lmi.org> wrote in message
news:#LP9y7VbBHA.1856@tkmsftngp05...

Charles Allard [MS]

unread,
Feb 19, 2002, 2:45:31 PM2/19/02
to
Hi David,

>>>>>>>
Thanks for the suggestion. Unfortunately, the settings were already set the
way you described.

Any other suggestions would be greatly appreciated.
<<<<<<<
Very interesting problem. Where you able to resolve your SQLMail issue?
If not, can you log into the server using the same account you are
attempting to use with SQLMail. Next, I would like to have you remove all
profiles currently created within Outlook, and then create a new profile
for Outlook (NOTE: do not use a local PST for this test). Open Outlook,
and confirm that you can send and receive email. If successful, open SQL
Server Enterprise manager, and verify whether the profile is visible for
SQLMail. If so, select the profile, and attempt to run test using
xp_sendmail.

If you are still finding this to fail, can you run the following script and
post the output:

--
-- sqlmailtest.sql
-- performs basic tests to verify SQL Mail environment
--
-- !!!SQL Server 2000 and Windows NT only!!!
--

set nocount on

print 'Starting SQL Mail test'
print ''

print 'user is logged into SQL Server as ' + suser_sname()

Declare @regMapikey nvarchar(256)
Declare @DefMapiClient nvarchar(256)
set @regMapikey = N'SOFTWARE\Clients\Mail'

exec master.dbo.xp_regread N'HKEY_LOCAL_MACHINE',
@regMapikey,
N'',
@DefMapiClient OUTPUT,
N'no_output'

print 'Default mail client is ' + @DefMapiClient

go

-- =============================================
-- Temp table to store profiles
-- =============================================
if exists (select * from tempdb.dbo.sysobjects where id =
object_id(N'tempdb..#sqlmailtest'))
drop table #sqlmailtest

create table #sqlmailtest
(
[Profile Name] nvarchar(128) not null,
[Is default profile] int not null default -1
)

-- =============================================
-- Variables
-- =============================================
declare @rc int
declare @p1 nvarchar(128)
declare @p2 nvarchar(128)
declare @profile nvarchar(128)
declare @regkey nvarchar(256)
declare @accnt nvarchar(128)

-- =============================================
-- Check if running SQL Server 2000
-- =============================================
select substring(convert(nvarchar(20), serverproperty('ProductVersion') ),
1, 4)

-- =============================================
-- Check if running Windows NT or Windows 2000
-- =============================================

-- =============================================
-- Check if not running SQL as LocalSystem
-- =============================================
select @p1 = convert(nvarchar(128), serverproperty('MachineName')),
@p2 = convert(nvarchar(128), serverproperty('InstanceName'))

-- @rc 0 = LocalSystem, 1 = running under account
exec @rc = master.dbo.xp_MSLocalSystem @p1, @p2
if (@rc = 0)
begin
raiserror('SQL Mail not supported running SQL Server under
LocalSystem', 19, 1) with log, nowait
print ''
print 'SQL Server is running under the LocalSystem account'
print 'SQL Mail is not able to be used under this account'
print 'please change to a domain or machine account with a'
print 'MAPI profile attached.'
return
end

-- =============================================
-- Get account name running SQL Server
-- =============================================
if (@p2 is null)
select @regkey = N'SYSTEM\CurrentControlSet\Services\MSSQLServer'
else
select @regkey = N'SYSTEM\CurrentControlSet\Services\MSSQL$' + @p2

exec master.dbo.xp_regread N'HKEY_LOCAL_MACHINE',
@regkey,
N'ObjectName',
@accnt OUTPUT,
N'no_output'

print 'SQL Server is running under account ' + @accnt

-- =============================================
-- Check if MAPI32.DLL is present
-- =============================================
-- xp_fileexist '%WINDIR%\system32\mapi32.dll'

-- =============================================
-- Is there a default profile (test 1)
-- =============================================
insert into #sqlmailtest([Profile Name]) exec @rc =
master.dbo.xp_get_mapi_default_profile
if (@rc <> 0)
print 'Warning: No default MAPI profile present (test 1)'
truncate table #sqlmailtest

-- =============================================
-- Enumerate all existing MAPI profiles for this account
-- =============================================
insert into #sqlmailtest exec @rc = master.dbo.xp_get_mapi_profiles
if (@rc <> 0)
print 'Error: enumerating MAPI profiles'

-- =============================================
-- Are there any MAPI profiles
-- =============================================
if not exists (select * from #sqlmailtest)
begin
raiserror('Error: No MAPI profile(s) present', 19, 1) with log, nowait
return
end

-- =============================================
-- Is there a default profile in the list
-- =============================================
declare @defprof int
select @defprof = count(*) from #sqlmailtest where [Is default profile] = 1
if (@defprof = 0)
print 'Warning: No default MAPI profile present (test 2)'

-- =============================================
-- test each profile
-- =============================================
print ''

declare mapicursor cursor read_only for select [Profile Name] as profile
from #sqlmailtest
open mapicursor

fetch next from mapicursor into @profile
while (@@fetch_status <> -1)
begin
if (@@fetch_status <> -2)
begin
print ''
print 'Testing MAPI profile : ' + @profile
print ''

exec @rc = master.dbo.xp_test_mapi_profile @profile
if @rc = 0
print ' Testing MAPI profile : ' + @profile + ' succeeded'
else
print '*** Testing MAPI profile : ' + @profile + ' failed ***'

exec @rc = master.dbo.xp_startmail @profile
if @rc = 0
print ' Start mail using MAPI profile : ' + @profile + '
succeeded'
else
print '*** Start mail using MAPI profile : ' + @profile + '
failed ***'

exec @rc = master.dbo.xp_stopmail
if @rc = 0
print ' Stop mail using MAPI profile : ' + @profile + '
succeeded'
else
print '*** Stop mail using MAPI profile : ' + @profile + '
failed ***'

end
fetch next from mapicursor into @profile
end

close mapicursor
deallocate mapicursor

if exists (select * from tempdb.dbo.sysobjects where id =
object_id(N'tempdb..#sqlmailtest'))
drop table #sqlmailtest

print ''
print 'Finished SQL Mail test'

-- End of test script

Sincerely,

Charles Allard
Microsoft SQL Support

========================================================


This posting is provided "AS IS" with no warranties, and confers no rights.

Recent viruses on the Internet underscore the threat to all computer users
and highlight challenges facing the entire industry in providing security
that everyone needs to conduct business. I encourage you to sign up to
receive automatic notification of Microsoft Security Bulletins by visiting
http://www.microsoft.com/technet/treeview/default.asp?url=/technet/security/
bulletin/notify.asp. For more information on security, our Strategic
Technology Protection Program and to order your FREE Security Tool Kit,
please visit http://www.microsoft.com/security. We will be happy to answer
any questions or provide assistance with your security needs.

0 new messages