all groups > sql server programming > may 2005 >
You're in the

sql server programming

group:

xp_sendmail Problems.


xp_sendmail Problems. David C
5/1/2005 4:33:02 PM
sql server programming: Hi All,

Recently my automated email sp has stopped working, I have attached the code
below, I don't really think it is the sp but was wondering what else could
make this job not work all of a sudden.

When run it just runs and runs and runs, usually it used to take around 1
second.

I have restarted the SQL Server Agent with no luck.

Cheers
David

---------------------------------------

CREATE PROCEDURE spr_Email_DataTransferComplete

@OutRetVal INT OUTPUT

AS


DECLARE @srecipients VARCHAR(1000)
DECLARE @smessage VARCHAR(1000)
DECLARE @ssubject VARCHAR(100)
DECLARE @ErrorNum INT
DECLARE @ErrorMessage VARCHAR(500)
DECLARE @ProcessID VARCHAR(30)
DECLARE @ProcessStatus CHAR(1)
DECLARE @Source VARCHAR(1000)

SET @Source = 'spr_Email_DataTransferComplete'
SET @ErrorNum = 0
SET @ssubject = 'Cognos Data Transfer Completed'
SET @srecipients = 'XXXX Powerplay Users'
SET @sMessage = 'All,

The Cognos data transfer completed at - ' + CONVERT(VARCHAR, GETDATE()) + '.
The portal reports will be avaialable at - ' + CONVERT(VARCHAR, DATEADD(MI,
40, GETDATE())) + '.
The cubes will start updating now and will finish in approximately 5hrs.

For any issues please log a call with the ServiceDesk.
This is an automated email, please do not reply.

Thank You'

IF (SELECT DATEPART(DW, GETDATE())) <> 7
BEGIN
EXEC @ErrorNum = Master..xp_sendmail
@recipients = @srecipients,
@subject = @ssubject,
@message = @smessage
END

IF @ErrorNum <> 0
BEGIN
SET @ErrorMessage = 'Failed to Send Email'
GOTO ERROR
END

-- No Error
NOERROR:
SET @OutRetVal = @ErrorNum
RETURN(@ErrorNum)

-- Error Handling
ERROR:
EXEC GG_JDE.dbo.sp_Log
@Type = 'E',
@Source = @Source,
@Message = @ErrorMessage
SET @OutRetVal = @ErrorNum
RETURN(@ErrorNum)
GO
Re: xp_sendmail Problems. Jens Süßmeyer
5/2/2005 12:00:00 AM
One way for error resolving would be to send out just a static text from the
QA to see what the problem is:

EXEC @ErrorNum = Master..xp_sendmail
[quoted text, click to view]

The results of the mail communication are displayed in the Message pane of
QA, there you might see what happened (no connection to mail server, wrong
auth., Mail rejected)

If you are no longer happy with XP_Sendmail, though it is based on Mapi you
might have a look at XP_SMTP_SENDMAIL at

http://www.sqldev.net/xp/xpsmtp.htm

which uses SMTP for sending out data. It has some enhancements you might be
happy for ;-)

HTH, Jens Suessmeyer.

---
http://www.sqlserver2005.de
---




"David C" <DavidC@discussions.microsoft.com> schrieb im Newsbeitrag
news:112582C4-00A5-4ED5-9648-15374AC82F48@microsoft.com...
[quoted text, click to view]

AddThis Social Bookmark Button