Showing posts with label emails. Show all posts
Showing posts with label emails. Show all posts

Monday, March 19, 2012

Job Failure emails not being sent in SQL 2005

Hi I am trying to configure notification emails on my sql2005 server for SQL
agent job failures. I have configured a mail profile in database mail and I
can send test emails which are received correctly.
I have configured the notification to email me when the job completes but
this is not working and I do not receive any notifications. When I look at
the job history
it gives me the message below after the normal job completion information.
NOTE: Failed to notify 'Email User' via email.
Any ideas as to want i can do to fix this problem.
Cheers
James
On Jan 28, 5:23 am, "Mark Yudkin" <DoNotContac...@.boingboing.org>
wrote:
> The most likely cause is that the userid running thejobis not permitted to
> sendemail. Check out the authorizations on your mailserverand add the
> necessary permissions.
> "James Matthews" <JamesMatth...@.discussions.microsoft.com> wrote in message
> news:30E73785-3D3D-4829-AB4A-3DB82F5E7E4F@.microsoft.com...
>
>
>
> - Show quoted text -
I encountered the same problem and fixed it by restarting the SQL
SERVER AGENT in Management Studio.

Job Failure emails not being sent in SQL 2005

Hi I am trying to configure notification emails on my sql2005 server for SQL
agent job failures. I have configured a mail profile in database mail and I
can send test emails which are received correctly.
I have configured the notification to email me when the job completes but
this is not working and I do not receive any notifications. When I look at
the job history
it gives me the message below after the normal job completion information.
NOTE: Failed to notify 'Email User' via email.
Any ideas as to want i can do to fix this problem.
Cheers
JamesThe most likely cause is that the userid running the job is not permitted to
send email. Check out the authorizations on your mail server and add the
necessary permissions.
"James Matthews" <JamesMatthews@.discussions.microsoft.com> wrote in message
news:30E73785-3D3D-4829-AB4A-3DB82F5E7E4F@.microsoft.com...
> Hi I am trying to configure notification emails on my sql2005 server for
> SQL
> agent job failures. I have configured a mail profile in database mail and
> I
> can send test emails which are received correctly.
> I have configured the notification to email me when the job completes but
> this is not working and I do not receive any notifications. When I look at
> the job history
> it gives me the message below after the normal job completion information.
> NOTE: Failed to notify 'Email User' via email.
> Any ideas as to want i can do to fix this problem.
> Cheers
> James
>|||On Jan 28, 5:23 am, "Mark Yudkin" <DoNotContac...@.boingboing.org>
wrote:
> The most likely cause is that the userid running thejobis not permitted to
> sendemail. Check out the authorizations on your mailserverand add the
> necessary permissions.
> "James Matthews" <JamesMatth...@.discussions.microsoft.com> wrote in messag
e
> news:30E73785-3D3D-4829-AB4A-3DB82F5E7E4F@.microsoft.com...
>
>
>
>
>
> - Show quoted text -
I encountered the same problem and fixed it by restarting the SQL
SERVER AGENT in Management Studio.

Job Failure emails not being sent in SQL 2005

Hi I am trying to configure notification emails on my sql2005 server for SQL
agent job failures. I have configured a mail profile in database mail and I
can send test emails which are received correctly.
I have configured the notification to email me when the job completes but
this is not working and I do not receive any notifications. When I look at
the job history
it gives me the message below after the normal job completion information.
NOTE: Failed to notify 'Email User' via email.
Any ideas as to want i can do to fix this problem.
Cheers
JamesThe most likely cause is that the userid running the job is not permitted to
send email. Check out the authorizations on your mail server and add the
necessary permissions.
"James Matthews" <JamesMatthews@.discussions.microsoft.com> wrote in message
news:30E73785-3D3D-4829-AB4A-3DB82F5E7E4F@.microsoft.com...
> Hi I am trying to configure notification emails on my sql2005 server for
> SQL
> agent job failures. I have configured a mail profile in database mail and
> I
> can send test emails which are received correctly.
> I have configured the notification to email me when the job completes but
> this is not working and I do not receive any notifications. When I look at
> the job history
> it gives me the message below after the normal job completion information.
> NOTE: Failed to notify 'Email User' via email.
> Any ideas as to want i can do to fix this problem.
> Cheers
> James
>|||On Jan 28, 5:23 am, "Mark Yudkin" <DoNotContac...@.boingboing.org>
wrote:
> The most likely cause is that the userid running thejobis not permitted to
> sendemail. Check out the authorizations on your mailserverand add the
> necessary permissions.
> "James Matthews" <JamesMatth...@.discussions.microsoft.com> wrote in message
> news:30E73785-3D3D-4829-AB4A-3DB82F5E7E4F@.microsoft.com...
>
> > Hi I am trying to configurenotificationemails on my sql2005serverfor
> >SQL
> > agentjobfailures. I have configured a mail profile in database mail and
> > I
> > can send test emails which are received correctly.
> > I have configured thenotificationtoemailme when thejobcompletes but
> > this is not working and I do not receive any notifications. When I look at
> > thejobhistory
> > it gives me the message below after the normaljobcompletion information.
> > NOTE: Failed to notify 'EmailUser' viaemail.
> > Any ideas as to want i can do to fix this problem.
> > Cheers
> > James- Hide quoted text -
> - Show quoted text -
I encountered the same problem and fixed it by restarting the SQL
SERVER AGENT in Management Studio.

Wednesday, March 7, 2012

Job Exe calling MAPI object, fails

Hi!
I have got a VB.NET exe which is using MAPI object to read the emails.
Now, the exe works excellent if I execute it independently. However, my
requirement is, I have to call this exe through SQL Jobs (SQL Agent). Now,
when I do that way, the MAPI logon fails, everytime.
It is giving me this error:
[Collaboration Data Objects - [MAPI_E_LOGON_FAILED(80040111)]]
Please help!
Regards,
Sachin VaishnavThe SQL agent will use a MAPI profile associated with the SQL Agent service
login, not the currently logged-in console user. Log in to the console
using the SQL Agent service account and create the correct MAPI profile.
Geoff N. Hiten
Senior Database Administrator
Microsoft SQL Server MVP
"Sachin Vaishnav" <SachinVaishnav@.discussions.microsoft.com> wrote in
message news:01864869-CAC2-45C9-A88A-6E8102BF1F70@.microsoft.com...
> Hi!
> I have got a VB.NET exe which is using MAPI object to read the emails.
> Now, the exe works excellent if I execute it independently. However, my
> requirement is, I have to call this exe through SQL Jobs (SQL Agent). Now,
> when I do that way, the MAPI logon fails, everytime.
> It is giving me this error:
> [Collaboration Data Objects - [MAPI_E_LOGON_FAILED(80040111)]]
> Please help!
> Regards,
> Sachin Vaishnav

Job Exe calling MAPI object, fails

Hi!
I have got a VB.NET exe which is using MAPI object to read the emails.
Now, the exe works excellent if I execute it independently. However, my
requirement is, I have to call this exe through SQL Jobs (SQL Agent). Now,
when I do that way, the MAPI logon fails, everytime.
It is giving me this error:
[Collaboration Data Objects - [MAPI_E_LOGON_FAILED(80040111)]]
Please help!
Regards,
Sachin VaishnavThe SQL agent will use a MAPI profile associated with the SQL Agent service
login, not the currently logged-in console user. Log in to the console
using the SQL Agent service account and create the correct MAPI profile.
--
Geoff N. Hiten
Senior Database Administrator
Microsoft SQL Server MVP
"Sachin Vaishnav" <SachinVaishnav@.discussions.microsoft.com> wrote in
message news:01864869-CAC2-45C9-A88A-6E8102BF1F70@.microsoft.com...
> Hi!
> I have got a VB.NET exe which is using MAPI object to read the emails.
> Now, the exe works excellent if I execute it independently. However, my
> requirement is, I have to call this exe through SQL Jobs (SQL Agent). Now,
> when I do that way, the MAPI logon fails, everytime.
> It is giving me this error:
> [Collaboration Data Objects - [MAPI_E_LOGON_FAILED(80040111)]]
> Please help!
> Regards,
> Sachin Vaishnav

Job Exe calling MAPI object, fails

Hi!
I have got a VB.NET exe which is using MAPI object to read the emails.
Now, the exe works excellent if I execute it independently. However, my
requirement is, I have to call this exe through SQL Jobs (SQL Agent). Now,
when I do that way, the MAPI logon fails, everytime.
It is giving me this error:
[Collaboration Data Objects - [MAPI_E_LOGON_FAILED(80040111)]]
Please help!
Regards,
Sachin Vaishnav
The SQL agent will use a MAPI profile associated with the SQL Agent service
login, not the currently logged-in console user. Log in to the console
using the SQL Agent service account and create the correct MAPI profile.
Geoff N. Hiten
Senior Database Administrator
Microsoft SQL Server MVP
"Sachin Vaishnav" <SachinVaishnav@.discussions.microsoft.com> wrote in
message news:01864869-CAC2-45C9-A88A-6E8102BF1F70@.microsoft.com...
> Hi!
> I have got a VB.NET exe which is using MAPI object to read the emails.
> Now, the exe works excellent if I execute it independently. However, my
> requirement is, I have to call this exe through SQL Jobs (SQL Agent). Now,
> when I do that way, the MAPI logon fails, everytime.
> It is giving me this error:
> [Collaboration Data Objects - [MAPI_E_LOGON_FAILED(80040111)]]
> Please help!
> Regards,
> Sachin Vaishnav

Job error: converting datetime from char string?

Hello,

I'm trying to set up a Job in SQL Server 2000 that emails company employees if they haven't completed a timesheet in the last 24 hrs.

The only job step I have looks like:

declare
@.em varchar(100),
@.flname varchar(50),
@.ls datetime,
@.bdy varchar(500)

declare ts_cursor cursor for
SELECT FL_EMAIL, FL_NAME, LASTSHEET FROM F_AND_L WHERE dateadd(dd,1,LASTSHEET)>getdate()
open ts_cursor
fetch next from ts_cursor
into @.em, @.flname, @.ls

while @.@.FETCH_STATUS=0
begin
select @.bdy='Dear ' +@.flname+ ','+CHAR(13)+CHAR(10)+CHAR(13)+CHAR(10)+
'Hello, this is an automatic email. The timesheet records seem to indicate'+
' that the last time you completed a timesheet was '+@.ls+ ' .'+CHAR(13)+CHAR(10)+
'Could you please complete one? Thanks :)'+CHAR(13)+CHAR(10)+CHAR(13)+CHAR(10)+
'Regards,'+CHAR(13)+CHAR(10)+CHAR(13)+CHAR(10)+
'The Intranet'
exec master.dbo.sendmail @.em,@.bdy,@.subject='Timesheets'
fetch next from ts_cursor
into @.em, @.flname, @.ls
end
close ts_cursor
deallocate ts_cursor

(I should add that this was cannibalised from an existing job and I've never done this before).

At the moment it returns an error:

"Executed as user: NT AUTHORITY\SYSTEM. Syntax error converting datetime from character string. [SQLSTATE 22007] (Error 241). The step failed."

What does this mean, and how do I fix it? I've run the select query in Query Analyser and it runs fine. My only thought is that it's the date format that's screwing it but I don't know how to check.

Any suggestions?

Ta,

Spud.The error is in the formating of your message string, you can only concatenate string variables.

select @.bdy='Dear ' +@.flname+ ','+CHAR(13)+CHAR(10)+CHAR(13)+CHAR(10)+
'Hello, this is an automatic email. The timesheet records seem to indicate'+
' that the last time you completed a timesheet was '+@.ls+ ' .'+CHAR(13)+CHAR(10)+
'Could you please complete one? Thanks '+CHAR(13)+CHAR(10)+CHAR(13)+CHAR(10)+
'Regards,'+CHAR(13)+CHAR(10)+CHAR(13)+CHAR(10)+

Test this, it will error out

declare @.ls datetime

set @.ls = getdate()

print 'The time is ' + @.ls

However either of these will work

declare @.ls varchar(30)

set @.ls = getdate()

print 'The time is ' + @.ls

** OR **

declare @.ls datetime

set @.ls = getdate()

print 'The time is ' + CONVERT(VARCHAR(30),@.ls)