Solved

How can I Sende email notification Form Shaduled job in sql server 2008

Posted on 2011-09-14
12
555 Views
Last Modified: 2012-05-12
Hi experts:


I hope somebody can help in this
I need to receive email notification when my job tasks in sql server succeed or competed or failed
I did the following
1 - I configure my sql server 2008 to send email notification and I tested successfully
By creating profile and account.
2 - From SQL server surface area configuration manager I did enabling Database mail stored procedure
3 - Port 25 opened
4 - I run the following scripts
sp_CONFIGURE 'show advanced', 1
GO
RECONFIGURE
GO
sp_CONFIGURE 'Database Mail XPs', 1
GO
RECONFIGURE
GO

When I test by running the following script I receive the email .
USE msdb
GO
EXEC sp_send_dbmail @profile_name='Profile1',
@recipients='mhaidar@skmc.ae',
@subject='Test message',
@body='This is the body of the test message.
Congrates Database Mail Received By you Successfully.'

5- I create operator … MAK
6 - I create backup task and I configure it to send email notification to operator MAK
My Problem That I did not receive the email when job succeed or competed or failed

I need help please
0
Comment
Question by:Haidar1
  • 6
  • 4
  • 2
12 Comments
 

Author Comment

by:Haidar1
ID: 36535178
I forget to mention ... I did restart to the SQL agent ....
0
 
LVL 10

Expert Comment

by:gaurav05
ID: 36535237
0
 
LVL 10

Accepted Solution

by:
sqlservr earned 500 total points
ID: 36535249
did you enable the mail profile in agent properties,ceck the image attached
123.JPG
0
 

Author Closing Comment

by:Haidar1
ID: 36535292
thanks a lot a spend all my day for this.


Regards
0
 

Author Comment

by:Haidar1
ID: 36540984
Hi experts
Yesterday .. I did above configuration and was successful
today change the account ... but the test failed i returen the account as before but no lcuk , can you help plesae?

I am getting the following message

Message
The mail could not be sent to the recipients because of the mail server failure. (Sending Mail using Account 3 (2011-09-15T09:56:19). Exception Message: Cannot send mails to mail server. (The SMTP server requires a secure connection or the client was not authenticated. The server response was: 5.7.1 Client was not authenticated).
)
0
 
LVL 10

Expert Comment

by:gaurav05
ID: 36541009
Hi,

Basically answer to this error is that mention an account name who has the rights to send an email in the Basic Authentication option .

also check with following URL
http://blog.sqlauthority.com/2008/08/23/sql-server-2008-configure-database-mail-send-email-from-sql-database/
0
Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

 
LVL 10

Expert Comment

by:gaurav05
ID: 36541023

Also check this :

Use smtp.gmail.com for the server
port to 587 (Use port 587, port 465 lets you waiting)
Require secure connections checked
*Basic authentication*
username (use the full email address with @gmail.com)
password (RETYPE – the SSMS messes up the password so the autentication fails with port 587)

You may also want to read this…
(http://support.microsoft.com/kb/970315/LN/kb/968834/)
(http://support.microsoft.com/kb/968834/ )

0
 

Author Comment

by:Haidar1
ID: 36541028

Thanks for youre reply

I saw this link before ...but I dont know what shall I do I return the account as before ... but still not wroking???

I hope if you can help
0
 
LVL 10

Expert Comment

by:gaurav05
ID: 36541038
Try this.

start – programs – microsoft sql server 2008 –
configuration tool – sql server surface area configuration – surface area configuration and features

the two more things what we have to keep these things in mind while configuring database mail:

* by default port for database mail is 25.
so open that port in the firewall.

* grant permissions to relay e-mail through SMTP

start – administrative tools- Internet Information Services – expand local computer – default SMTP virtual Server Properties
- thn click tab Access thn Relay – add -
then enter IP address – click ok
0
 

Author Comment

by:Haidar1
ID: 36541063

I use in the username : username@domain.com

regarding the port 25 is opend

0
 

Author Comment

by:Haidar1
ID: 36541219
I am getting the following error

The mail could not be sent to the recipients because of the mail server failure. (Sending Mail using Account 2 (2011-09-15T08:32:24). Exception Message: Cannot send mails to mail server. (The SMTP server requires a secure connection or the client was not authenticated. The server response was: 5.7.1 Client was not authenticated).
)
0
 
LVL 10

Expert Comment

by:sqlservr
ID: 36541889
check your sntp mail server.
0

Featured Post

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

In this article I will describe the Detach & Attach method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
Ever wondered why sometimes your SQL Server is slow or unresponsive with connections spiking up but by the time you go in, all is well? The following article will show you how to install and configure a SQL job that will send you email alerts includ…
Via a live example combined with referencing Books Online, show some of the information that can be extracted from the Catalog Views in SQL Server.
Viewers will learn how to use the SELECT statement in SQL to return specific rows and columns, with various degrees of sorting and limits in place.

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now