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
 Transact-SQL (2000)
 Send mail to a group

Author  Topic 

baska123
Yak Posting Veteran

64 Posts

Posted - 2006-06-22 : 18:06:42
I am trying to send an email to a group with the following alias name ITSuccessManagement
Here is the code that does not work:
EXEC master..xp_sendmail @recipients = 'ITSuccessManagement',@message = @vMessage, @subject = @vSubject

is there another function that we use to send emails to groups?

timmy
Master Smack Fu Yak Hacker

1242 Posts

Posted - 2006-06-22 : 19:21:47
I think it depends on what mail server you're using. If it's Exchange, I'm pretty sure that each group has it's own virtual address that you can use.
Maybe someone else might be able throw more light on this one....

Tim
Go to Top of Page

baska123
Yak Posting Veteran

64 Posts

Posted - 2006-06-23 : 10:19:15
Absolutely, each group has it's own virtual address, however when I am using it the mails is still not send.
Go to Top of Page

baska123
Yak Posting Veteran

64 Posts

Posted - 2006-07-13 : 10:37:16
Here is my code, I still have this problem.

CREATE PROCEDURE Billing_SendMail_SP @Billing_Period_Id INT, @MailFlag INT

AS

DECLARE @vMessage VARCHAR(1000)
DECLARE @vSubject VARCHAR(100)
DECLARE @vBillingMonth VARCHAR(30)

BEGIN

SELECT @vBillingMonth = BILLING_MONTH --SUBSTRING(BILLING_MONTH,1,4) + CAST(YEAR(START_DT) AS VARCHAR)
FROM BILLING_PERIOD
WHERE BILLING_PERIOD_ID = @Billing_Period_Id

SET @vMessage = 'Dear Billing Administrator,' + CHAR(13) + CHAR(13)

SET @vMessage = @vMessage + 'Monthly Billing Process Scheduled for ' + LTRIM(RTRIM(@vBillingMonth))

IF @MailFlag = 1
BEGIN
SET @vMessage = @vMessage + ' was Sucessfully excuted on '+ convert(varchar(20),getdate(),101) + '. JL transactions are generated.'
SET @vMessage = @vMessage + CHAR(13) + CHAR(13) + 'File Name:' + CHAR(9) + 'PACE_Charge_' + convert(varchar(10),getdate(),120)
SET @vSubject = 'Billing Process Sucessful'
END

IF @MailFlag = 2
BEGIN
SET @vMessage = @vMessage + ' Failed. JL transactions could not be generated.'
SET @vSubject = 'Billing Process Failed'
END

IF @MailFlag = 3
BEGIN
SET @vMessage = @vMessage + ' was Sucessful. JL transactions could not be generated'
SET @vSubject = 'Billing Process - JL Transactions Failed'
END

SET @vMessage = @vMessage + CHAR(13) + CHAR(13) + CHAR(13) + CHAR(13) + CHAR(13) + '***** This is a system generated message. Please do not reply. *****'

EXEC master..xp_sendmail @recipients = 'ITSuccessManagement',@message = @vMessage, @subject = @vSubject
END
GO

In this code I use alias name, but i also tried to use list email and still did not work. Any thoughts?
Go to Top of Page

baska123
Yak Posting Veteran

64 Posts

Posted - 2006-07-13 : 10:50:34
Here is the message I get when i run this stored procedure, however email is not send.

SQL Mail session started.
Mail sent.
Go to Top of Page
   

- Advertisement -