Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Administration (2000)
 SQL Mail question

Author  Topic 

dcarva
Posting Yak Master

140 Posts

Posted - 2004-02-26 : 23:04:46
Hello,

I just configured SQL mail on SQL Server 2000. I had to create a MAPI profile so that it could send the mail. Works fine, but, it only sends the mail if I have Outlook open. The profile I used is also being used in Outlook. How can I make it work without having Outlook open? I thought SQL would create it's own MAPI session to send the mail. Any ideas?

Thanks,
Danny

sphadke
Yak Posting Veteran

55 Posts

Posted - 2004-02-26 : 23:08:09
quote:
Originally posted by dcarva

Hello,

I just configured SQL mail on SQL Server 2000. I had to create a MAPI profile so that it could send the mail. Works fine, but, it only sends the mail if I have Outlook open. The profile I used is also being used in Outlook. How can I make it work without having Outlook open? I thought SQL would create it's own MAPI session to send the mail. Any ideas?

Thanks,
Danny



Danny,

you could use the xp_sendmail procedure to send an email using SQL server without the need to keep outlook open.

here is a sample syntax of xp_sendmail as taken from Books Online (BOL)

EXEC xp_sendmail @recipients = 'robertk;laurac',
@message = 'The master database is full.',
@copy_recipients = 'anned;michaels',
@subject = 'Master Database Status'


Sachin
Go to Top of Page

dcarva
Posting Yak Master

140 Posts

Posted - 2004-02-26 : 23:11:38
Thank you for your prompt reply. I want SQL to email me whenever an alert fires off. Shouldn't it be able to send the mail without running the stored proc or no? Is that just the way it works?

Thanks!!
Go to Top of Page

sphadke
Yak Posting Veteran

55 Posts

Posted - 2004-02-26 : 23:17:24
quote:
Originally posted by dcarva

Thank you for your prompt reply. I want SQL to email me whenever an alert fires off. Shouldn't it be able to send the mail without running the stored proc or no? Is that just the way it works?

Thanks!!



you can configure your SQL to send emails to ur email account or ur blackberry as soon as an alert is triggered. You don't need a proc to do that. But your email account needs to be configured with the SQL Mail account.


Sachin
Go to Top of Page

dcarva
Posting Yak Master

140 Posts

Posted - 2004-02-26 : 23:18:21
Yes. It is configured to send mail and it sends mail fine. But I have to have Outlook open for the mail to be sent out. If I close Outlook, the mail never gets sent.

Thanks
Go to Top of Page

sphadke
Yak Posting Veteran

55 Posts

Posted - 2004-02-26 : 23:27:00
Thats strange.. I have never come across something like that. is your sql mail service not running?


Sachin
Go to Top of Page

dcarva
Posting Yak Master

140 Posts

Posted - 2004-02-26 : 23:28:13
Yes, it's running. Thanks
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2004-02-27 : 12:34:17
How is the MAPI profile configured?

Tara
Go to Top of Page

derrickleggett
Pointy Haired Yak DBA

4184 Posts

Posted - 2004-02-27 : 12:46:05
You have to login as the account that is running SQL Server. Set up the MAPI profile for that account. You should then be able to login as whoever you want and the SQLMail will work.

Go to Services and find the account that is running SQL Server.

Login as the account and set up MAPI. Login to Outlook and set it as default client, etc. Close Outlook.

After that it should always work.

MeanOldDBA
derrickleggett@hotmail.com

When life gives you a lemon, fire the DBA.
Go to Top of Page

dcarva
Posting Yak Master

140 Posts

Posted - 2004-02-27 : 23:16:31
Hi,

Thanks for your reply. I have done exactly what you said to do. I logged in with the account used to run the SQL Server services. I created a MAPI profile. Outlook is the default client. All works great when Outlook is open. When I close it, nothing works. I have rebooted, restarted all services, etc., etc. Not sure what I am missing.

Thanks for your time!
Go to Top of Page

JohnDeere
Posting Yak Master

191 Posts

Posted - 2004-02-28 : 00:50:15
You need to configure the sql agent to use the mapi profile you set up using outlook.

Lance Harra
Go to Top of Page

dcarva
Posting Yak Master

140 Posts

Posted - 2004-02-28 : 00:59:20
Thanks. Yes I did that. It sends email just fine. The problem is that it only sends the email when Outlook is open.
Go to Top of Page

The Enigma
Posting Yak Master

179 Posts

Posted - 2004-02-28 : 02:39:18
is it a pop3 server
Go to Top of Page

dcarva
Posting Yak Master

140 Posts

Posted - 2004-02-28 : 19:21:03
The email I am using in the profile is a pop3 server, if that's what you mean.

Thanks
Go to Top of Page

derrickleggett
Pointy Haired Yak DBA

4184 Posts

Posted - 2004-02-28 : 20:31:21
The automated alerts only work if your MAPI profile is mapped to a MAPI enabled mail server. Your POP3 server is not. This is why your email only gets processed when Outlook is open.




MeanOldDBA
derrickleggett@hotmail.com

When life gives you a lemon, fire the DBA.
Go to Top of Page

dcarva
Posting Yak Master

140 Posts

Posted - 2004-02-29 : 10:38:08
Oh, I see. Like an Exchange server. Ok. Thanks!
Go to Top of Page

dcarva
Posting Yak Master

140 Posts

Posted - 2004-02-29 : 19:12:47
Here's a SWEEEEEET workaround...

http://sqldev.net/xp/xpsmtp.htm
Go to Top of Page

derrickleggett
Pointy Haired Yak DBA

4184 Posts

Posted - 2004-02-29 : 19:21:36
Not sure how this would help you.

Q: How do I use XPSMTP, for sending SQL Agent Alerts and job notitications?
A: Since SQL Agent does not use SQL Mail, but relies on a different MAPI based mail implementation (named SQL Agent Mail), which is hosted in a separate DLL (SEMMAP.DLL), it is not possible to replace the SQL Agent Alerts and job notifications directly with an SMTP based solution.

Technically you could achieve it by replacing the SEMMAP.DLL file with one that implements an SMTP based mail, which is something I have tried and works, but since replacing Microsoft DLL's renders your system unsupported this is not a viable solution that can be publicly shippped.

You can add extra job steps to your jobs to send a success or failure email, however this requires extra logic and does not cover the Alert scenario. Tibor Karaszi (SQL Server MVP) created a solution for Alerts using XPSMTP, which is available on http://www.dbmaint.com/SmtpAlerter.asp


That's from the article. You really need to have a service that's MAPI enabled.

MeanOldDBA
derrickleggett@hotmail.com

When life gives you a lemon, fire the DBA.
Go to Top of Page

dcarva
Posting Yak Master

140 Posts

Posted - 2004-02-29 : 19:24:08
Right, I see your point, but for each alert, I scheduled a job to execute. The job then runs a sql query which sends me an email regarding the alert. It works.
Go to Top of Page

derrickleggett
Pointy Haired Yak DBA

4184 Posts

Posted - 2004-02-29 : 22:55:24
Kewl! :)

MeanOldDBA
derrickleggett@hotmail.com

When life gives you a lemon, fire the DBA.
Go to Top of Page

dcarva
Posting Yak Master

140 Posts

Posted - 2004-03-02 : 12:06:55
Thanks for your help! You were right about Outlook and helped me get to my answer.
Go to Top of Page
    Next Page

- Advertisement -