Email Being Sent, But No Message
Jul 20, 2005
I have setup an email notifications system, that basically takes each
row from a table and sents out an email according to the data in that
row. The emails get sent, with the subject being filled as expected.
Only problem is that sometimes there is no message.
Here is the stored procedure that is being called every hour to send
the emails:
CREATE PROCEDURE dbo.RemindersSendEmails AS
--Cursor
DECLARE RemindersCursor CURSOR FOR
SELECT *
FROM RemindersTodaysAndUnsent
--Values for cursor
DECLARE
@I_Reminder_ID bigint,
@I_Notice_ID bigint,
@V_Reminder_Text varchar(250),
@SDT_Reminder_Date smalldatetime,
@V_Email varchar(50),
@I_Reminder_Type bigint,
@SDT_Reminder_Sent smalldatetime,
@I_Attempts_Made int,
@V_Notice_Type varchar(50),
@I_Notice_Period int,
@V_Period_Description varchar(50),
@I_Project_ID bigint,
@V_Notice_Ref varchar(10)
--values for sending the mail
DECLARE @NEWLINE varchar(2)
OPEN RemindersCursor
FETCH NEXT FROM RemindersCursor
INTO @I_Reminder_ID, @I_Notice_ID, @V_Reminder_Text,
@SDT_Reminder_Date, @V_Email, @I_Reminder_Type,
@SDT_Reminder_Sent, @I_Attempts_Made, @V_Notice_Type,
@I_Notice_Period, @V_Period_Description,
@I_Project_ID, @V_Notice_Ref
--INTO @I_Reminder_ID, @I_Notice_ID, @V_Reminder_Text,
@SDT_Reminder_Date, @V_Email, @I_Reminder_Type,
--@SDT_Reminder_Sent, @I_Attempts_Made, @V_Notice_Type,
@I_Notice_Period, @V_Period_Description,
--@I_Project_ID, @V_Notice_Ref
SET @NEWLINE = char(10)
--PRINT 'start'
WHILE @@FETCH_STATUS = 0
BEGIN
DECLARE @EmailMessage varchar(6000), @Subject varchar(100), @Status
int
SET @Subject = RTRIM(CONVERT(varchar(8), @I_Reminder_ID)) + ' Notice
Alert - Project ' + RTRIM(CONVERT(varchar(8), @I_Project_ID)) + '
Notice Ref ' + RTRIM(@V_Notice_Ref)
SET @EmailMessage = 'Project: ' + RTRIM(CONVERT(varchar(8),
@I_Project_ID)) + @NEWLINE +
'Notice: ' + RTRIM(@V_Notice_Ref) + @NEWLINE +
'Notice Type: ' + RTRIM(@V_Notice_Type) + ' - ' +
RTRIM(@V_Period_Description) + @NEWLINE +
'Reminder: ' + RTRIM(@V_Reminder_Text) + @NEWLINE + @NEWLINE +
'Reminder date: ' + CONVERT(varchar(11), @SDT_Reminder_Date) +
@NEWLINE +
'Reminder sent: ' + CONVERT(varchar(11), GETDATE()) + @NEWLINE +
'Email sent to: ' + @V_Email + @NEWLINE +
'Number of attempts made at sending this email (once every hour): '
+ CONVERT(varchar(4), @I_Attempts_Made)
--@I_Reminder_ID, @I_Notice_ID, @V_Email, @I_Reminder_Type,
@I_Notice_Period,
PRINT 'subject = ' + @Subject
PRINT 'message = ' + @EmailMessage
SET @V_Email = LTRIM(RTRIM(@V_Email))
EXEC @Status = master..xp_sendmail @recipients = @V_Email,
@message = @EmailMessage,
@subject = @Subject
--PRINT 'XXXXXXXXXXXXXXXXXXXXXX status = ' + CONVERT(varchar(2),
@Status)
--If send mail is a success
IF (@Status = 0)
BEGIN
UPDATE Reminders
SET SDT_Reminder_Sent = GETDATE(), I_Attempts_Made =
@I_Attempts_Made + 1
WHERE I_Reminder_ID = @I_Reminder_ID
END
--Else send mail failed
ELSE
BEGIN
UPDATE Reminders
SET I_Attempts_Made = @I_Attempts_Made + 1
WHERE I_Reminder_ID = @I_Reminder_ID
END
-- Get the next reminder
FETCH NEXT FROM RemindersCursor
INTO @I_Reminder_ID, @I_Notice_ID, @V_Reminder_Text,
@SDT_Reminder_Date, @V_Email, @I_Reminder_Type,
@SDT_Reminder_Sent, @I_Attempts_Made, @V_Notice_Type,
@I_Notice_Period, @V_Period_Description,
@I_Project_ID, @V_Notice_Ref
END
--PRINT 'End'
CLOSE RemindersCursor
DEALLOCATE RemindersCursor
GO
View 2 Replies
ADVERTISEMENT
Sep 7, 2000
If I want any SQL error message created inside a database to send an error
message is the xp_sendmail the way to go?
View 3 Replies
View Related
Jul 23, 2005
Hi,I am constructing a Message (Body) for sending our Emails. It is around3000 characters long. But for whatever reason, the last line seems tobe broken with a "!" exclamatory mark in it, which results indisplaying the constructed image path as a broken one.How to resolve this ?. Thanks.Regards,Karthick
View 3 Replies
View Related
Jan 2, 2008
I am trying to capture an error message and email to myself whenever the script has an error. I have an email task event handler on OnError and use the variable errormsg as my email body. I have the errormsg variable with a package wide scope defined as string with a value of @[System::ErrorDescription]. Is there anything elso I need to do to make this work?
View 10 Replies
View Related
Apr 23, 2008
Hi,
I have define an "execute SQL task" followed by an "Send Email Task" :
http://img171.imageshack.us/img171/449/pic562qn9.gif
http://img171.imageshack.us/img171/1793/pic564jo2.gif
I want to include the package name that is being executed in the message body of the email, How can i do this ?
I have tried to set an output parameter with Variable Name "System:ackageName", but i get the message :
Variable "System:ackageName" cannot be used as an out parameter or return value in a parameter or return value in parameter ....
View 6 Replies
View Related
Feb 7, 2008
Hello,
Is there a way that I can set up an error handler on a DataFlow so that errant rows within the DataFlow are delivered to a user via email?
I'm looking for Primary Key Violations. In this case, there are two columns of data involved in the DataFlow (AcctCode, RebateRate).
Thank you for your help!
cdun2
View 11 Replies
View Related
Nov 2, 2006
I used onError event to send email in case ssis pckage fails
but it send multiple email with errordescription. for ex below are the errordescription of four diferent emails i received.
Thread "WorkThread0" has exited with error code 0xC0047039.
An error occurred with the following error message: "The connection "{01AF859A-CF97-4F6C-9C78-1AA4B1C9C27B}" is not found. This error is thrown by Connections collection when the specific connection element is not found.".
Thread "SourceThread0" has exited with error code 0xC0047038.
The PrimeOutput method on component "Flat File Source - Read from source file" (1) returned error code 0xC0202092. The component returned a failure code when the pipeline engine called PrimeOutput(). The meaning of the failure code is defined by the component, but the error is fatal and the pipeline stopped executing.
Can anyone suggest if we can combine all this error description and send this as one email.
View 2 Replies
View Related
Feb 15, 2008
Hello,
I have a SQL Task that executes some stored procedure. When a condition is met the stored procedure raises an error by calling RAISERROR (@ErrorMessage,16,1). Following the SQL Task I have Send Mail Task that sends an error email.
I would like to know how to include the @ErrorMessage in the error email.
Thank you,
-Oleg
View 3 Replies
View Related
Feb 28, 2006
How do you set up the service broker to process an email message, and how do you format that message and send it to the que.
Can the service broker alos process an html form from a que.
Thanks
View 1 Replies
View Related
Nov 5, 2015
I have a table that gets queued up with a list of people for example email, first name, temporary login account and temporary password.How would i create a store procedure to feed these fields into the html message for each record. For example:
Dear <first name>,
Your temporary access is listed below.
Login: <temporary login>
Password: <temporary password>
I am not sure how you insert the data into the html message. It has to be in html because the message has a couple hyperlinks.
View 6 Replies
View Related
Dec 14, 2007
I have an SSIS package set up to run various SQL scripts and to notify me if any of the SQL scripts fail. This is working fine, but when I get the email it only says that the script has failed. Is there any way to actually show the SQL result with the error in it? This would save me from having to go and manually run the script again to see the error message.
Thanks
Kate
View 31 Replies
View Related
Oct 5, 2005
Hello everyone,
Please i need your help...
I dont know how to place the field 'strTitle and datBorrowed " in my email? Not as an attachment though....Just write it in the mail as part of message body...
I use this SQL select statement to retrieve the strTitle and datBorrowed fields
strSQL += @"Select replace(strtitle,'[Original Book] - ',''), datBorrowed from tblBooks where convert(varchar(10),datBorrowed,101) = convert(varchar(10),(getdate() - 1),101) ORDER BY strTitle asc";
Now, I have the following code to write the email
static void SendTest()
{
int iEmailLanguage = 0;
MailMessage objMail;
objMail = new MailMessage();
objMail.From = MAIL_FROM;
objMail.To =MAIL_TO;
objMail.Subject = "Books Borrowed Yesterday";
objMail.Body = Dict.GetVal(iEmailLanguage, "EMAIL_MESSAGE");
objMail.Attachments.Add(new MailAttachment(strAttachment));
SmtpMail.SmtpServer = SSMTP_SERVER;
SmtpMail.Send(objMail);
}
And the body of the email is this......
Dict.AddVal(0, "EMAIL_MESSAGE", "*** This e-mail is automatically generated. ***" +
"*** PLEASE DO NOT REPLY TO THIS E-MAIL. ***" +
"" +
"Books Borrowed Yesterday are:" +
"" +
"" +
"Thank you," +
"" +
"eLibrarian" +
"" +
"================================================== ===============" +
"" +
"This e-mail is automatically generated by the Library system." +
"Please do not reply.");
i need to put or wedge the data i got from the SQL Statement into this or after the line "Books Borrowed Yesterday are:" +
So how should i do this?
View 3 Replies
View Related
Jun 25, 2014
What I am trying to do, Extract the data from SQL table and Insert in Email Body and email to user. I got good article on Internet, I follow all steps as it is, but still I am getting error.
Here is the link : [URL] ....
But I am getting Error:
Error: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.FormatException: Index (zero based) must be greater than or equal to zero and less than the size of the argument list.
at System.Text.StringBuilder.AppendFormat(IFormatProvider provider, String format, Object[] args)
at System.String.Format(IFormatProvider provider, String format, Object[] args)
at ST_7f59d09774914001b60a99a90809d5c5.csproj.ScriptMain.Main()
[Code] ....
View 4 Replies
View Related
Jun 17, 2015
Exec Prcoess task with source : ftp
destination :ftpunzip
work directory ftpunzip
executable : c:Program FilesWinZip
i am using expressing.
It is doing the unzip but getting this error
package process on server server1 has failed within the Task 'Unzip Files' with the following errors:
>
> File/Process "WZUNZIP.EXE" does not exist in directory "c:Program FilesWinZip".
This is the error message i am getting it
View 6 Replies
View Related
May 9, 2002
I have a public mailbox that gets information mailed to it (in a pre-determined format).
Is there a way for that info to be put into a table in SQL Server without any user interaction (something running on the exchange server)?
I hope I've given enough info.
Thanks for any and all help!
Ron
View 1 Replies
View Related
Jul 6, 2015
I have a report that gets sends out through a subscription and sometimes the report has multiple pages and all those pages appear within one email.Is it possible to set the subscription in such a way that an email is sent per page when the subscription executes.
View 2 Replies
View Related
May 4, 2007
Under IIS SMTP I can set bounced email redirect etc. how to do that with dbmail, the idea is I can get the list of bounced emails somewhere so I can create a report.
Any idea?
thanks
View 2 Replies
View Related
May 12, 2008
need help
split list of email add comma for evry email
i have tabe "tblLogin" and in this table i have field emall
like this
emall
-----------------------------------------
aaa@hhhh.mm
nnn@hhhh.mm
mmm@hhhh.mm
need to do ilke this
Code Snippet
@list_email = (SELECT emall FROM tblLogin)
--------------------------i get this
-----------------------@list_email=aaa@hhhh.mm ; nnn@hhhh.mm ; mmm@hhhh.mm
@recipients = @list_email
Code Snippet
IF EXISTS( SELECT * FROM [db_all].[dbo].[taliB] )
BEGIN
DECLARE @xml NVARCHAR(MAX)DECLARE @body NVARCHAR(MAX)
SET @xml =CAST(( SELECT
FirstName AS 'td','',
LastName AS 'td','' ,
Date_born AS 'td','' ,
Age AS 'td','' ,
BirthdayToday AS 'td','' ,
BirthdayThisWeek AS 'td'
FROM [Bakra_all].[dbo].[taliB] ORDER BY LastName FOR XML PATH('tr'), ELEMENTS ) AS NVARCHAR(MAX))
SET @body ='<html><H1 align=center>aaaaaaaaaaaaaaaaaaaaaa</H1><body ><table border = 1 align=center dir=rtl>
<tr>
<td>name</td>
<td>fname</td>
<td>date</td>
<td>age</td>
<td>aaaaaaaaa</td>
<td>bbbbbbbbbbbbbbb</td>
</tr>'
SET @body = @body + @xml +'</table></body></html>'
EXEC msdb.dbo.sp_send_dbmail
@recipients =N'rrr@iec.co.il',
@copy_recipients='rrrrr@iec.co.il',
@body = @body,
@body_format ='HTML',
@subject ='ggggggggggggggggggggg',
@profile_name ='ilan'
END
ELSE
print 'no email today'
View 1 Replies
View Related
Jul 23, 2007
In my SQL Server, I see the below message in the Application Event Viewer
"18265 :
Log backed up: Database: HSD, creation date(time): 2007/01/06(05:05:05), first LSN: 1439:495055:1, last LSN: 1439:496675:1, number of dump devices: 1, device information: (FILE=1, TYPE=DISK: {'D:MSSQLBACKUPHSDHSD_tlog_200707141300.TRN'})."
When I save the application event viewer and open it in another server, I do not see the above message, instead I get the following message:
" Can't find or load message DLL. Message DLL must be in path or in current directory."
Any thoughts to overcome this problem is appreciated.
Thanks
Santhosh
View 3 Replies
View Related
Aug 8, 2007
I run SB between 2 SQL servers. In profiler on an initiator side I see next error: 'This message could not be delivered because its message timestamp has expired or is invalid'. For the conversation we use best practice, i.e. target closes a conversation. Target side succeed to close conversation, but initiator still stay in DO (disconnect_outbound).
What is a reasone for the error? What to do?
View 5 Replies
View Related
Aug 8, 2007
I see in profiler this error: "This message could not be delivered because its message timestamp has expired or is invalid"
What is a reason for error?
View 1 Replies
View Related
Jul 12, 2007
Hello ALL
what I want to achieve is to load a text file that has email addreses from disk and using the email addresses in the text file look it up against the email addresses in the database table then once matched delete all the users in the table whose email address were in the text file.
I also want to update some users using a different text file.
Please help me with the best way to do this
Thanks in advance
View 6 Replies
View Related
Nov 17, 2006
Hello,
I am having trouble specifying a message body that is valid. I mean for the client to send. If I leave it as null then everything is ok but if I create a memorystream and add a line of text it reports back it did not pass validation. I do not understand this and am not sure what to do. I need to send a message based on a code and text but do not know the format of the body that is allowed. The code I am refering to comes out of HelloWord_CLR because that is what I am formating my sample after. I call it the same way it calls the return message done in ServiceProc. I need to know the message format including body since this does not seem to work. A sample of the call is bellow.
// Create an empty request message
string Msg = "Hello";
MemoryStream body = new MemoryStream(Encoding.ASCII.GetBytes(Msg));
Message request = new Message("Request", body);
Thanks,
Scott Allison...
View 1 Replies
View Related
Sep 5, 2000
How do i get the email to be send automatically from SQL
My SQL Server is configured so if sends an email after running a job. The email is been succesfully sent by SQL, but is not atually sent until you login and start up Microsoft Outlook and client on Send and Receive.
Surely there is a way to get SQL to automatically send the message.
I have got outlook to send message immeditally.
My mail server is SendMail - SCO Open Server 5.06
Thanks
David
View 1 Replies
View Related
Mar 9, 2001
Is there a way SQL server to email/send a query results to a user ?
Thanks in advance.
Ivan
View 2 Replies
View Related
Aug 9, 2001
Trying to get a job step to send an email with an explaination in certain failure conditions. The problem is I want the recipient to be the job's operator.
don't know of a way to accesss the job's operator email address cleanly from inside a step
Any ideas?
View 2 Replies
View Related
Sep 20, 2001
IF I HAVE ONE OR MANY PACKAGES HOW DO SEND AN EMAIL TO MY BOSS IF IT BLOWS UP?? ex. INPUT IS MY TRUNCATE STEP, CONNECTION 1 IS MY ODBC, CONECTION 2 IS WHERE THE RESULT WILL BE PLACED INTO. AT ANY ONE OF THOSE STEPS, It BLOWS HOW TO SEND AN EMAIL. THE EMAIL IS ALREADY SETUP BECAUSE I TESTED IT IN THE QUERY ANALYZER WITH THIS STATEMENT ( EXEC xp_sendmail @recipients = 'robertk;laurac',
@message = 'The master database is full.',
@copy_recipients = 'anned;michaels',
@subject = 'Master Database Status') AND IT WORKS.
View 2 Replies
View Related
Jun 29, 2004
I want to write a stored procedure that will email Sales Associates and notify them if a customer has had a return number issed for return of defective product. I wanted to do this daily. I am using SQL Server 2000. Is there a way to get SQL to send an email without using Microsoft Exchange? I have a network that is using Workgroup mode and not domains. I can provide SQL a mailbox on our Linux mail server to send the mail.
View 1 Replies
View Related
Aug 23, 2004
Hi all me again I gotta question, the Sr executive asst has a number of reports that gets emailed to different department, only problem is those departments are on a totally different server. I am guessing that we need to start SQL AGENT Emailing MAPI to do this for us, of course I could be wrong. This is one of the stored procedures that creates one of the reports
CREATE PROCEDURE createSecurityListtobeEmailed
AS
SELECT SecurityListX."Last Name", SecurityListX."First Name", SecurityListX.MI, SecurityListX.Sex, SecurityListX.DOB, SecurityListX.IR#, SecurityListX."Issue Date", SecurityListX."Date served", SecurityListX.Duration, SecurityListX."Exp Date", SecurityListX."Reason for Exclusion", SecurityListX."Added Comment", SecurityListX.type INTO SecurityList
FROM SecurityListX
GROUP BY SecurityListX."Last Name", SecurityListX."First Name", SecurityListX.MI, SecurityListX.Sex, SecurityListX.DOB, SecurityListX.IR#, SecurityListX."Issue Date", SecurityListX."Date served", SecurityListX.Duration, SecurityListX."Exp Date", SecurityListX."Reason for Exclusion", SecurityListX."Added Comment", SecurityListX.type
HAVING (((SecurityListX."Last Name") Is Not Null))
GO
View 9 Replies
View Related
Nov 17, 2004
I am trying to setup my sql to send automatic emails to different companies but I am not doing so well. The user puts an email address in the database and then presses a button (command button) that will execute a stored procedure xp_sendmail to a recepient. I need to know how to include read receipts and delivery receipts into the stored procedure, because right now its set up in his outlook as a rule to do this and I want to set it up in sql. The user deals with companies and these companies have several contacts with several email addresses which sql will store in a seperate table.
View 1 Replies
View Related
Feb 5, 2004
How can I implement the functionality of sending mail with the help of SP or DTS?
Subhasish
View 2 Replies
View Related
May 31, 2007
I have tried a few different stored procedures but i'm looking for away to send email from a server that does not have email enabled. (I want to pass in the smtp server and email and password.
Does anyone know of any script?
View 4 Replies
View Related
Oct 24, 2007
Hello everyone
I am working on a little project for work which get the relvant data every 2mins and puts the data into a Data Grid in ASP.net 2.0
Now my SQL scipt runs every 2min and i need to know if at a certain time i could tell the SQL script to run the report and email me the results???
any help would be great
thanks alistair
View 4 Replies
View Related