How To Send Notification To Multiple Email Accounts?

Sep 26, 2007


I am in process of setting up job failure notification and one of the requirements that I have is to send notification to multiple users. I would appreciate any suggestion. One of the possible ways would be to create some sort of group account on exchange server with all users added as members. Is there anyway though where I could use users' individual accounts and based on that forward notification to them?

Thanks

View 5 Replies


ADVERTISEMENT

How To Send Email To Multiple Recipients

Jun 3, 2008

Dear all,
i am using sql server 2005.
i am facing a scenario where i have to send mail to single or multiple user depending on the query.
i tried this stmt to send mail to multiple receipints
EXEC msdb.dbo.sp_send_dbmail @profile_name = 'imran' , @recipients= 'imran.khan@bbraun.com;amol.puranik@bbraun.com', @subject = 'Test mail'
it succesfully sent mail.

Now i want to send mail depending on query. with single employee it is no issue. but if it is more then one employee how can i mail to multiple recipient.

That is my question is in this sp to send multiple recepients one has to separates addresses with ; semi colon how can i arreange recipient so that ; comes in between.

Thank you.

View 7 Replies View Related

T-SQL (SS2K8) :: Send Multiple Rows With One HTML Table In Email?

Dec 2, 2014

I have a job below, which takes the results and send to the users in email.But I have a question, how can I send only one email with all rows, not to send the for every row on table separated email.

DECLARE @Body VARCHAR(MAX)
DECLARE @StartDate DATETIME
DECLARE @EndDate DATETIME
DECLARE @RowCountINT
DECLARE@idINT
declare@departmentnvarchar(30)

[code]....

View 2 Replies View Related

Creating Stored Procedure To Send Email To Multiple Users

Sep 20, 2007

Hi Everybody,

I am trying to setup a stored procedure that runs through a Reminders table and sends an email to users based on DateSent field being smaller than todays date. I have already setup the stored procedure to send the email, just having trouble looping through the recordset.




Code Snippet


CREATE PROCEDURE [dbo].[hrDB_SendEmail]

AS

BEGIN


DECLARE @FirstName nvarchar(256),

@LastName nvarchar(256),

@To nvarchar(256),

@ToMgr nvarchar(256),

@Subject nvarchar(256),

@Msg nvarchar(256),

@DateToSend datetime,

@Sent nvarchar(256),

@ReminderID int,

@RowCount int,

@Today datetime,

@Result nvarchar(256)

-- Get the reminders to send


SELECT

@ReminderID = r.intReminderID,

@DateToSend = r.datDateToSend,

@FirstName = e.txtFirstName,

@LastName = e.txtLastName,

@To = e.txtEmail,

@Subject = t.txtReminderSubject,

@Sent = r.txtSent

FROM


(auto_reminders r INNER JOIN employee e ON r.intEmployeeID = e.intEmployeeID) INNER JOIN ref_reminders t ON r.intReminderType = t.intReminderTempID

WHERE


(((r.datDateToSend)<20/12/09) AND

((r.txtSent)='False'))

-- Send the Emails


WHILE(LEN(@To) > 0)

BEGIN


EXEC @Result = sp_send_cdosysmail @To, @ToMgr, @Subject, @Msg

END

-- Mark the records as sent

IF @Result = 'sp_OAGetErrorInfo'


BEGIN


SELECT @Sent = 'Error'

END
ELSE


BEGIN


SELECT @Sent = 'True'

END
UPDATE auto_reminders

SET


auto_reminders.txtSent = @Sent, auto_reminders.datDateSent = @Today

WHERE


intReminderID = @ReminderID

END

GO







From the code you can probably tell I am new to writing stored procedures, so I apologise for any obvious errors. My major problems are :-


how to loop through each record

how to get todays date

whether the struture of the procedure is correct
Also, if you think there is an easier way or a better method, please suggest it. I am open to any suggestions you may have,

Thanks in advance
Ben

View 1 Replies View Related

Transact SQL :: Send Email To Multiple Users Based On A Column

May 15, 2015

I have a query running and returning 3 columns, user name, e-mail and device name

SELECT DISTINCT v_R_User.Full_User_Name0 AS 'User full Name', v_R_User.Mail0 AS 'E-Mail', _RES_COLL_DEV00144.Name
FROM         v_R_System INNER JOIN
                      v_R_User ON v_R_System.User_Name0 = v_R_User.User_Name0 INNER JOIN
                      _RES_COLL_DEV00144 ON v_R_User.User_Name0 = _RES_COLL_DEV00144.UserName INNER JOIN
                      v_GS_COMPUTER_SYSTEM ON v_R_System.ResourceID = v_GS_COMPUTER_SYSTEM.ResourceID
 Where v_R_User.Mail0 <> ''
ORDER BY 'User Full Name'

From here I would like to generate an e-mail to each user (like mail merge) to each user in the table an include their machine name. I can do it with PS, but rather have it run directly from SQL. Is it possible?

View 9 Replies View Related

Integration Services :: Send HTML Email With Multiple Attachments Dynamically

Sep 30, 2015

I am using the below code to send HTML Email body to multiple recipients and CC, its working fine. Now i have to attach multiple files in that mail. Is there any possibilities to attach multiple files with the below code else provide any other code to achieve this task.

Code:
/*
   Microsoft SQL Server Integration Services Script Task
   Write scripts using Microsoft Visual C# 2008.
   The ScriptMain is the entry point class of the script.

[code]...

View 6 Replies View Related

Do Managed Local Accounts Remove Need For Multiple Domain Accounts

Aug 12, 2015

I cannot get a consistent answer as to how many domain accounts would be suggested in a SQL Server 2014 installation. Previously the recommendation was a separate account for each service to provide isolation and minimum permissions for each account. It seems from what I've read that a single domain account would have something added to make it unique from SQL Server's perspective. Several still advocate multiple accounts. I don't know if they are doing so because that's the way it's always been done or if there is still some compelling reason to do so. I don't want to create unnecessary accounts simply because something is "ideal."

View 8 Replies View Related

Is It Possible To Set Up Email Notification For

Apr 14, 2006

MSDE 2000? Thanks.

View 2 Replies View Related

Email Notification

Oct 25, 2005

Can you send these to a group of DBA's

View 1 Replies View Related

Notification Email On Job

Feb 26, 2007

How can I set up the notification email when one of your jobs got failed using Database mail..

I've already set up the database mail ... but I am not quite sure how to use the database mail to send a notification when a job failed...

View 3 Replies View Related

Email Notification?

May 14, 2008

I need to set up an automatic email notification. Right now, I have a subscription that is working. The subscription runs a report and puts the resulting pdf into a folder. I need a way to notify users (preferrably in an Outlook distribution list) when the pdf is created. I'm amazed that this basic feature is not built into the subscription capabilities.

Can anyone please tell me how to best accomplish this? I'm familiar with vb.net if that helps.


Thank you very much.

View 3 Replies View Related

Automatic Email Notification

Dec 25, 2007

Hello
i am new to sqlserver 2000.i have list of email id in a table. need to fetch that emailid and send mail to the appropriate id's.any body knows how to write job schedule for this task.Ideas are welcome

View 7 Replies View Related

SQLAgent Jobs Email Notification

Jun 24, 2004

This sends a success or fail status and length of execution time can it be extended to send error details when it fails

View 1 Replies View Related

SQL Server Event Email Notification??

Aug 10, 2004

I am trying to set up the email notification system in SQL server 2000, but im having some problems. Mainly, im having problems with setting up an email account in the first place (there is a dedicated mail box, but the one im working with is a different box altogether).

If anyone could help fathom this out from start to finish i would be really grateful.

View 1 Replies View Related

How Can I Grab A Notification Email Address From A Job?

Dec 9, 2004

Is there a handy-dandy way for me to be able, from a stored procedure, to capture the notification email address for a user associated with a job?

I need to send an email out from a stored procedure, and I want it to be set up to send to the same user that is set up in the job that calls the stored procedure.

the same notification stored proc will be used in multiple jobs, but the jobs are already set up with a notification email to be sent to the defined users "on completion" (error or not). I want a separate email to be sent, but I want to use xp_Sendmail because I have to perform a select who's output I want to appear in the body of the email (and unless I am missing something, I have no control over the body of the standard "job completion" email).

I would prefer to NOT have to "hard code" the user email address in the stored proc that calls xp_sendmail, OR to put it in some user table in the database, when the user I want to send it to will always be the same one defined in at the JOB level in Enterprise Manager.

Any thoughts? Thanks in advance for your instantaneous and informative answer-packed responses! ;)

View 2 Replies View Related

T-SQL (SS2K8) :: Trigger And Email Notification

Oct 17, 2015

I have created a trigger like this below:

CREATE TRIGGER TriggerName ON Table_Name AFTER INSERT AS
DECLARE @SERVICE varchar(40)
DECLARE @STATUS varchar(3)

SET @SERVICE=(SELECT [SERVICE] FROM inserted)
SET @STATUS=(SELECT [STATUS] FROM inserted)

[Code] ....

When I added some a new record to Table_Name with Status='X' nothing happened. I have tried to exec only script below:

EXEC msdb.dbo.sp_send_dbmail @recipients=N'moj_adres', @body= 'test', @subject = 'Subject!!!!', @profile_name = 'profil'

and I received email notification.

View 7 Replies View Related

Sending Email Via Notification Services?

Nov 13, 2007

Hi All

I just wondered that now SQL Mail is classed as a legacy solution for email, does anyone know how to set up Notification Services to send email once a job has completed e.g. Backup or reindex?

I have tried to find a tutorial but with no joy so far!

Thanks

Gopher

View 2 Replies View Related

Using IS For Email Notification With Gmail Smtp

Nov 12, 2007



Hi,

I want to setup a SMTP using gmail. How to configure it, it says,


In your email client software, under Outgoing mail, set the SMTP server to smtp.gmail.com.
Set the your username is yourgooglemailname@gmail.com and make sure "Use username and password" is checked.
Also check off "TLS" under "Use secure connection."
I tried to do this in code:


Dim htmlMessage As MailMessage

Dim mySmtpClient As SmtpClient

htmlMessage = New MailMessage(From, SendTo, Subject, Body)

htmlMessage.IsBodyHtml = IsBodyHTML

mySmtpClient = New SmtpClient(Server)

Dim myCred As New System.Net.NetworkCredential("myemail@gmail.com", "mypassword") 'CredentialCache

mySmtpClient.UseDefaultCredentials = False 'Credentials = System.Net.CredentialCache.DefaultNetworkCredentials

mySmtpClient.Credentials = myCred

mySmtpClient.Send(htmlMessage)



however, i cannot do the turning off of TLS in code. I'm often prompted with this error once i run:

The SMTP server requires a secure connection or the client was not authenticated. The server response was: 5.7.0 Must issue a STARTTLS command first

Anyone who knows how to do this?


cherriesh

View 1 Replies View Related

Scheduled Tasks Failing Because Of Email Notification

Jun 2, 1999

Good morning,

I have a strange problem with a scheduled task failing with the following:

"Unable to send completion notification email to operator with email name '' for task 2780, 'Scheduled Update'"

This job is the same across several servers and the job runs on the other servers. This is a bit frustrating... I cannot seem to find the difference that is causing the problem.

The funny thing is that I am not using SQLMail or anything to notify anyone regardless if the job succeeds or fails.

Any pointers?

Thanks much,

Don

View 2 Replies View Related

How To Setup Email Notification For Msde 2000?

Apr 14, 2006

is it possible? Thanks.

View 1 Replies View Related

Setting Up Email Notification In Sql Server Mgmt

Mar 6, 2007

within sql server management studio... we have set up a few sql scripts to run at 2am every night (sql server agent > under jobs)... although it has been successful each night, we'd like to setup sql server agent to automatically email success and failure notifications to our email boxes.

i see under the properties of sql server agent > jobs > properties of a job > there is section that says Notifications but then it doesnt really have a place to type in which email we want to send them to? some reading material or instructions greatly appreciated

View 5 Replies View Related

Setup Email To Notification From SQL Server 2005

Aug 18, 2007

Hi,
My name is Vinh, I am a new bee in SQL Server 2005. I am using template script (see below) from SQL Server to create account but when I am right click in database mail for testing email and I got the message, could not connect to mail server.

Below I am trying to use smtp to connect but I know in my company we are using Exchange Mail Server. will that make a lot different?

Please help me,

Thank you very much,



sp_configure 'database mail xps', 1
GO
reconfigure
GO

-------------------------------------------------------------
-- Database Mail Simple Configuration Template.
--
-- This template creates a Database Mail profile, an SMTP account and
-- associates the account to the profile.
-- The template does not grant access to the new profile for
-- any database principals. Use msdb.dbo.sysmail_add_principalprofile
-- to grant access to the new profile for users who are not
-- members of sysadmin.
-------------------------------------------------------------

DECLARE @profile_name sysname,
@account_name sysname,
@SMTP_servername sysname,
@email_address NVARCHAR(128),
@display_name NVARCHAR(128);

-- Profile name. Replace with the name for your profile
SET @profile_name = 'TestProfile';

-- Account information. Replace with the information for your account.

SET @account_name = 'vdang';
SET @SMTP_servername = 'smtp.cgdnow.com';
SET @email_address = 'vdang@cdgnow.com';
SET @display_name = 'Vinh, Dang';


-- Verify the specified account and profile do not already exist.
IF EXISTS (SELECT * FROM msdb.dbo.sysmail_profile WHERE name = @profile_name)
BEGIN
RAISERROR('The specified Database Mail profile (<profile_name,sysname,SampleProfile>) already exists.', 16, 1);
GOTO done;
END;

IF EXISTS (SELECT * FROM msdb.dbo.sysmail_account WHERE name = @account_name )
BEGIN
RAISERROR('The specified Database Mail account (<account_name,sysname,SampleAccount>) already exists.', 16, 1) ;
GOTO done;
END;

-- Start a transaction before adding the account and the profile
BEGIN TRANSACTION ;

DECLARE @rv INT;

-- Add the account
EXECUTE @rv=msdb.dbo.sysmail_add_account_sp
@account_name = @account_name,
@email_address = @email_address,
@display_name = @display_name,
@mailserver_name = @SMTP_servername;

IF @rv<>0
BEGIN
RAISERROR('Failed to create the specified Database Mail account (<account_name,sysname,SampleAccount>).', 16, 1) ;
GOTO done;
END

-- Add the profile
EXECUTE @rv=msdb.dbo.sysmail_add_profile_sp
@profile_name = @profile_name ;

IF @rv<>0
BEGIN
RAISERROR('Failed to create the specified Database Mail profile (<profile_name,sysname,SampleProfile>).', 16, 1);
ROLLBACK TRANSACTION;
GOTO done;
END;

-- Associate the account with the profile.
EXECUTE @rv=msdb.dbo.sysmail_add_profileaccount_sp
@profile_name = @profile_name,
@account_name = @account_name,
@sequence_number = 1 ;

IF @rv<>0
BEGIN
RAISERROR('Failed to associate the speficied profile with the specified account (<account_name,sysname,SampleAccount>).', 16, 1) ;
ROLLBACK TRANSACTION;
GOTO done;
END;

COMMIT TRANSACTION;

done:

GO

View 3 Replies View Related

License Expiration Date Notification Via Email

Jan 24, 2008

We are maintaining a database of drivers, and we are looking for a script or procedure that will automatically notify certain users of the list of drivers who are in need of a recheck or driver's license has expired.
I am new to this , so any help you can give would be greatly appreciated

View 1 Replies View Related

Running Time Of Package To Be Logged In The Email Notification

Sep 12, 2007



Hi,

I want to include the running time (Start Time and End Time) of the Package in my script task that sends out an email after job completion.

How do I get the start time and end time?

thanks a lot

cherriesh

View 6 Replies View Related

Xp_sendmail Fails But Alert System Sends Email Notification.

Nov 30, 2004

I receive the following error when trying to invoke xp_sendmail 'xp_sendmail: failed with mail error 0x80070005'. However, for alert notifications the email works fine. SQL is using an alias account to send mail. This account doesn't have any funny characters. Any ideas why the alert system works but xp_sendmail does not? The invokation of xp_sendmail is being done by SA.

Thanks.

View 6 Replies View Related

Transact SQL :: Email Notification Of Count Of Pending And Suggested Name On Daily Basis

Oct 23, 2015

I have a query which sends email notification of count of pending name and suggested name.. on a daily basis. So this works fine but now I want like if the pending and suggested are ' o count' I don't want the email notification. It should not send an email, if it is o count, but if we have the number for pending and suggested this email should be sent.

View 8 Replies View Related

Reporting Services :: Data Driven Subscription Notification Via Email For SSRS Report

Aug 26, 2015

I want to create data driven subscription via Email for SSRS report.

To do so i can add my self either in To or CC.

I don't want multiple mails in my inbox as sent mails have excel as attachment, but I want notification for all the mails sent.

View 2 Replies View Related

Send Email Through SQL

Sep 11, 2006

Hi all, can i send an email through SQL? i don't want to use third party software. Also, i can't configure the customer's db server. It is possible to send an email without much configuration. If configuration needed, is it possible to configure through SQL script? thx 

View 8 Replies View Related

How To Send Email

Mar 27, 2008

Hi,
I need to select a table from my database and send the table as an email message to a person every 10am because the table changes every day. How to it?

View 2 Replies View Related

Send Email

Jan 30, 2008



Hi all,

actually i m working on a store procedure in which end of the procedure when task complete it's send email to specific person, but i m having a problem using this function.

i am using


EXEC master..xp_sendmail @subject = @cmd, @recipients = @recipients, @message = @@servername


it's work fine when the outlook is configure on the server, but is there any way to send email rather then configure outlook on the server just chk internet is working send email on behalf of server,
i have more then 2 servers and outlook is configure only one server and i don't want to configure outlook on other server due to work load on server.



Thanks and looking forward.
-MALIK

View 4 Replies View Related

How Can I Send Email Through Sqlserver?

Sep 6, 2007

How can i send email through sqlserver on Micrsoft Exchange? 

View 2 Replies View Related

Send Email From Sql Server

Oct 25, 2004

How can I send an email from sql server.

I tried the following code which gives me no errors but doesn't send the email.


Code:

CREATE Procedure sp_SMTPMail@SenderName varchar(100),@SenderAddress varchar(100),@RecipientName varchar(100),@RecipientAddress varchar(100),@Subject varchar(200),@Body varchar(8000)ASSET nocount ondeclare @oMail int --Object referencedeclare @resultcode intEXEC @resultcode = sp_OACreate 'CDONTS.NewMail', @oMail OUTif @resultcode = 0BEGINEXEC @resultcode = sp_OASetProperty @oMail, 'From', @SenderAddressEXEC @resultcode = sp_OASetProperty @oMail, 'To', @RecipientAddressEXEC @resultcode = sp_OASetProperty @oMail, 'Subject', @SubjectEXEC @resultcode = sp_OASetProperty @oMail, 'Body', @BodyEXEC @resultcode = sp_OAMethod @oMail, 'Send', NULLEXEC sp_OADestroy @oMailENDSET nocount off GO
GO



Can anyone recommend a solution to send email from sql server?

View 1 Replies View Related

CDOSYS Send Email

Feb 8, 2005

This was a P A I N to get working. Maybe someone else here is sending email and could use it.

A UNICODE Send Mail using CDOSYS with ReadReceipt and Importance...

Sub SendMail (sFromAddress, sToAddress, sCcAddress, sBccAddress, sSubject, sBody, boolReadReceipt, intImportance )
'on error resume next
Const cdoDispositionNotificationTo = "urn:schemas:mailheader:disposition-notification-to"
Const cdoReturnReceiptTo = "urn:schemas:mailheader:return-receipt-to"
dim cdoMessage, cdoConfiguration

Set cdoConfiguration = Server.CreateObject ("CDO.Configuration")
' Outgoing SMTP server
With cdoConfiguration
.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "localhost"
.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
.Fields("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
.Fields("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 60
.Fields.Update
End With


Set cdoMessage = CreateObject("CDO.Message")
With cdoMessage
' Update the CDOSYS Configuration
SET .Configuration = cdoConfiguration
.BodyPart.charset = "unicode-1-1-utf-8"

IF boolReadReceipt Then
.Fields(cdoDispositionNotificationTo)= sFromAddress
.Fields(cdoReturnReceiptTo)= sFromAddress
End If

' Set the Importance: 0:Low, 1:Normal, 2:High
.Fields("urn:schemas:httpmail:importance").Value= intImportance
.Fields.Update
.From= sFromAddress
.ReplyTo= sFromAddress
.To= sToAddress
.Cc= sCcAddress
.Bcc= sBccAddress
.Subject= sSubject
.Textbody= sBody
.Send
End With

Set cdoMessage = Nothing
Set cdoConfiguration = Nothing
End Sub

View 6 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved