Xp_Sendmail Does Everything But Actually Sending The Message

Jul 20, 2005

I have everything set up with SQL Server 2000 and Outlook 2000 and the
procedure works fine but the message sits in my inbox. When it open
the e-mail it says this message has not been sent. I just click send
and the e-mail sends. Is there any reason I have to manually sent the
e-mail after the xp_sendmail procedure works and should send the
e-mail itself.

Thanks
John

View 1 Replies


ADVERTISEMENT

Sending Message Using Xp_sendmail

Jun 18, 2007

Hi I have difficulty in sending message to different reciepients. I am using SSIS package to send in the parameter. If anybody could help to resolve will be great.



Thanks



declare @MailMsg varchar(1000)
select @MailMsg = 'Hi there,
Here are the Documents Nos. and details
Status.

Thank you.'
exec master.dbo.xp_sendmail
@recipients = ?,
@subject = 'Documents Status',
@message = @MailMsg,
@attachments = 'C:MyWorkDocument.XLS'

View 10 Replies View Related

Sending File Contents In The Body Of The Email With Xp_sendmail

Jul 23, 2005

I would like to send the contents of a file using xp_sendmail howeverI do not want the file contents to be an attachment.I have no problem sending the file as an attachement.Can anybody give me an xp_sendmail example of how to do this.The results of a query can easily appear in the body of the email butall myattempts to include the contents of a file in the body of the emailhave not worked.TIA

View 1 Replies View Related

Send A File As @message In Xp_sendmail

Mar 3, 2000

Can i send a file as the body of @message
in the extended sp xp_sendmail?
Pls help! thanks for any help.

View 2 Replies View Related

Passing @parameters And TEXT To Xp_sendmail Message!!

Jan 29, 2004

How do you pass parameters and text to the message area... i know how to pass parameters or pass text how do i do both... for example.


Exec master.dbo.xp_sendmail @recipients = 'johndoe' @message = 'hello and @number'


PLZ HELP!!!!!!

View 1 Replies View Related

Xp_sendmail Problem - Body Message Breaking Onto New Line..

Sep 13, 2005

Created a SP that uses system function XP_SENDMAIL. I wantto be able to send a HYPERLINK in the email. TheHYPERLINK is created dynamically and generally long in length (exceedsdefault width of 80 characters) and when rendered in the email is splitacross 2 lines. The problem is that when you click on the link itdisregards the part of the link that has been split onto the linebelow.Does anyone know a solution to this - how to extend the width of theemail to wider that 80 characters so that the link is not split over 2lines? I know that you can use the @width parameter when placing themessage in an attatchment, however I want the link to be placed in thebody of the email and not in an attachment.Any help is much appreciated..

View 2 Replies View Related

SQLServer2000 Xp_sendmail Message Larger Than 8000 Chars

Sep 3, 2007

Books Online gives a way to send a message larger than the VARCHAR max of 8000 chars, but the @query argument to xp_sendmail is a simple text string and my data is much more complex, and formatted. Also BOL shows an example using a temporary text file, but it is not clear precisely how you write your insert statements. I tried the following, which writes out all the data and sends it ok except, after each row, there is about a page of blank spaces. What is wrong with my syntax?

SET LANGUAGE British
GO
DECLARE @msgstr VARCHAR(80)
DECLARE @cmd VARCHAR(80)
DECLARE @PMID INT
DECLARE @forename VARCHAR(30)
CREATE TABLE ##texttab (c1 text)
SET @msgstr = 'THE FOLLOWING QUOTES ARE CURRENTLY MARKED AS PENDING:'
INSERT ##texttab SELECT @msgstr
DECLARE C2 CURSOR FOR SELECT ProjMgrID FROM surdba.SVY_QUOTES WHERE StatusID=6
OPEN C2
FETCH NEXT FROM C2 INTO @PMID
WHILE @@FETCH_STATUS = 0
BEGIN
IF @PMID > 1000
SELECT @forename = ISNULL(Forename,' ') FROM surdba.SVY_PERSONNEL_GENERAL WHERE EmployeeID = @PMID
ELSE
SET @forename = ' '
INSERT ##texttab values (RTRIM(@forename))
FETCH NEXT FROM C2 INTO @PMID
END
CLOSE C2
DEALLOCATE C2
INSERT ##texttab values ( ' - This information is autogenerated from the Survey database.')
SET @cmd = 'SELECT c1 FROM ##texttab'
EXEC master.dbo.xp_sendmail @recipients = 'Robin Pearce',
@subject = 'ALL PENDING QUOTES',
@query = @cmd,
@no_header = 'TRUE'
DROP TABLE ##texttab
GO


Would appreciate any help on this one, I do not have time to learn HTML,
thanks
Robin Pearce

View 1 Replies View Related

Problem On Sending Message

Dec 3, 2005

Hi

View 4 Replies View Related

Sending PackageName In Email Message

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

Sending The Same Message To Multiple Servers

Jul 19, 2007

Can anyone outline some best practices for sending the same message out to multiple servers? What is the easiest way to do this?

Currently, I have a message sent from Server A to Server B, which is fired by a table insert, update, delete trigger.

The goal is to keep this table synchronized on many remote servers. It sounds like a tedious exercise to deploy the SSB messages, queues, services, etc to 20+ more sites! I am hoping there is a shortcut of some kind.

Any advice is appreciated.

View 7 Replies View Related

Sending Message With Sql Server 2005

May 3, 2006

I have a need to asynchronously send a short message to an application over


tcp/ip after the user makes a selection from a web browser.





We are developing a reservation system where the availability to users in


close physical proximity is indicated by lights at a kiosk. We want the user


to be able to make a reservation from a web browser over the internet, (which


checks the sql server db for availibility), and when the reservation is made,


the appropriate lights at the kiosk indicate it is unavailable.








I can think of three choices, but am unsure which is best:





1. Poll the server to look for the event. I don't like this since the


application will be connected over a dial up internet connection, and I want


to keep traffic to a minimum, although this seems the easiest to build.





2. Have the users web browser be redirected to the application's ip address


directly. Here I am not sure which message protocol to use. The kiosk


application will be a .net 2.0 windows form app, but not running on a server


per se, but windows xp pro.





3. Have the database relay a message to the kiosk. I like this way the best,


since the user does not need to know the ip address of the kiosk, and the


kiosk does not need to be open from all ip addresses for security reasons. I


am not which way to do this either. I have read a little about hosting web


services using http.sys, but we probably want a shared hosting plan due to


costs at this point, and they are restrictive about turning on the clr inside


the db. Is there a different way to send a short message?





I apologize in advance if this is the wrong forum.

View 1 Replies View Related

Sending One Message To Multiple Consumers

Feb 14, 2006

Hi Remus

What if I need multiple clients to read (RECEIVE) the same message?

Would it be possible?



Thanks

View 8 Replies View Related

Flow Of Events While Sending Message From One Serivce Two Another

Apr 3, 2006

Hello,

I want to know the exact flow of events when I use this statement:

BEGIN DIALOG CONVERSATION @dialog_handle
FROM SERVICE [SERVICE1]
TO SERVICE 'SERVICE2'
ON CONTRACT [MainContract]

Assuming that I have defined SERVICE1 for Queue1 in the initiator ,

and I have defined SERVICE2 for queue2 on the target.

Is this the flow:

1.Message first goes to the queue1
or
it directly goes to the SERVICE2 on target end point which in turn puts this message in Queue2 on the target?

2. target queue then activates the stored procedure which is connected to queue2 (let's say the procedure name is 'Processqueue2')

3.I noticed that even when none of the item comes in the queue, still when u use "ALTER QUEUE queue2 WITH STATUS = ON", that time also the 'processqueue2' is called.

4.'processqueue2' then fetch message from queue2 and process this. optionally it can send the acknowledgement message to the initiator or just send the end dialog message.

5.if i dont want 'processqueue2' to send the acknowledgement then
can I can directly send the End dialog from the inititor it self i.e. the end dialog just after sending the message.


BEGIN DIALOG CONVERSATION @dialog_handle
FROM SERVICE [SERVICE1]
TO SERVICE 'SERVICE2'
ON CONTRACT [MainContract]

SEND ON CONVERSATION @dialog_handle
MESSAGE TYPE SendMessageType ('hello from intiator')

END CONVERSATION @dialog

In this case why do i need queue1 at all?

my assumption here is that my communication is one way and i don't need the ACK from the target.

Thanks,

View 1 Replies View Related

Sending A Alert Message Using Send Mail Task

May 2, 2008

i have developed a pakage which populates a two different tables with reference to the xml files added to a folder which is watched by a security WMI task.it is governed by a sequence container which contains three for each loop container for working on the different files.i have different event handlers set up inside for each loop container tasks which contains , data flow task, execute sql task, and moving the processed file to the desired destination.i want to set up a send mail task on the package level using event handler on error, where i have set up a task for looging the error to the error table , i have tried to collect all the error messages in a array list variable . and trying to use that variable a s a message source. i could not under stand if i set the propogation variable in the sequence container as false than will the onpost execute event will fire the onpostexecute event handler in the package level.if show how can i send only one email for all the errors of package with error looging.

View 6 Replies View Related

Service Broker Sending Message To Self. Start Conversation With Self

Jan 29, 2008

I've got a situation where I want to put request message on a queue. Because starting a conversation is the only way to put messages on a queue I have to start a conversation with myself. So my Begin Dialog Statement looks something like this:



DECLARE @conversation_handle UNIQUEIDENTIFIER;

BEGIN DIALOG CONVERSATION @conversation_handle

FROM SERVICE [ServiceName1]

TO SERVICE 'ServiceName1'

ON CONTRACT [ContractName1]

WITH ENCRYPTION = OFF;

SELECT @conversation_handle AS ConversationHandle



I haven't noticed any problems with doing this but I wanted to know if there was anything wrong with it. Does someone know what problems this might cause?

View 4 Replies View Related

Sending An HTML Mail Message With The Script Task

Mar 28, 2008



while i was trying to execute the code for Sending an "HTML Mail Message with the Script Task" given at the link below http://msdn2.microsoft.com/en-us/library/ms403365.aspx


following error was encountered.


DTS Script Task has encountered an exception in user code:
Project namecriptTask_098956444e9f4ae195c3565569c9444b
The element cannot be found in a collection. This error happens when you try to retrieve an element from a collection on a container during execution of the package and the element is not there

at Microsoft.SqlServer.Dts.Runtime.Variables.get_Item(Object index)
at ScriptTask_098956444e9f4ae195c3565569c9444b.ScriptMain.Main() in dts://Scripts/ScriptTask_098956444e9f4ae195c3565569c9444b/ScriptMain:line 29


please help me

View 7 Replies View Related

I Am Getting This Message System.Data.SqlClient.SqlException: Xp_sendmail: Procedure Expects Parameter @user, Which Was Not Supplied.

Jun 21, 2005

I have looked all over my code and can not find anywhere that I am referencing the xp_sendmail procedure! Here is all the code<code>With sqlCmdUpdateParticipants
.Parameters("@ClassID").Value = ddlClass.SelectedItem.Value
.Parameters("@Person").Value = tbName.Text()
End With
cnCapMaster.Open()
sqlCmdUpdateParticipants.ExecuteNonQuery()
cnCapMaster.Close()</code>I am just getting a couple values and and inserting them into the database.  the insert works then I get darn error message.  This code worked at one time but it has been about 2 years sense I worked on it so who knows what might have happened sense then.Thanks,Bryan

View 6 Replies View Related

Sending An HTML Mail Message With The Script Task DOESNT WORK 4 ME

Oct 3, 2006

I set up the "Send Email Task" succesfully with "SMTP Connection to myExchangeSERVER" using "Windows Authentication"
However, as we all know - you can't have html format for the Send Mail Task. BUT this piece of code straight from MSDN doesnt work for me - each time it pops up this "Mail Sent Succesfully" - but I receive NO freaking EMAILs!!! Am I missing something or is it another one of those Microsoft "gotchas" ?

Imports System
Imports System.Data
Imports System.Math
Imports Microsoft.SqlServer.Dts.Runtime
Imports System.Net.Mail

Public Class ScriptMain
Public Sub Main()
Dim htmlMessageTo As String = "me.here@mydomain.com"
Dim htmlMessageFrom As String = "SSIS@mydomain.com"
Dim htmlMessageSubject As String = "SSIS Success - My Package"
Dim htmlMessageBody As String = _
Dts.Variables("User::HTMLtemplateText").Value.ToString
Dim smtpServer As String = "myExchangeSERVER"
SendMailMessage( _
htmlMessageTo, htmlMessageFrom, _
htmlMessageSubject, htmlMessageBody, _
True, smtpServer)

Dts.TaskResult = Dts.Results.Success

End Sub

Private Sub SendMailMessage( _
ByVal SendTo As String, ByVal From As String, _
ByVal Subject As String, ByVal Body As String, _
ByVal IsBodyHtml As Boolean, ByVal Server As String)

Dim htmlMessage As MailMessage
Dim mySmtpClient As SmtpClient

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

mySmtpClient = New SmtpClient(Server)
Dim myCred As New System.Net.CredentialCache()
mySmtpClient.Credentials = System.Net.CredentialCache.DefaultNetworkCredentials
mySmtpClient.Send(htmlMessage)
MsgBox("Mail sent")
End Sub

View 3 Replies View Related

Problem Sending 32KB Message Using ServiceBrokerInterface Example From Microsoft.Samples.SqlServer Namespace.

Jan 25, 2008

I have been using the ServiceBrokerInterface example for a project of mine and so far it has been very successfull. However , I recently attempted to use it to send a large-ish message (32K xml file from MS Word) to SQL. The message is recieved but the Body member of the message is null when I try to retrieve the data from within my stored procedure CLR method.

The only differences I can see between the message that does not work and those that do are that the one that doesn't is large and it is XML data that I read from a .xml file produced by MS Word as opposed to internally generated strings in the other working messages.

Does anybody have any suggestions as to why the body of the message is not being sent in this case?
Is there something about the example code that precludes sending this type of message?


This is the code that sends the message (extracted from Conversation.cs in ServiceBrokerExample)

string query = "SEND ON CONVERSATION @ch MESSAGE TYPE @mt ";
param = cmd.Parameters.Add("@ch", SqlDbType.UniqueIdentifier);
param.Value = m_handle;
param = cmd.Parameters.Add("@mt", SqlDbType.NVarChar, 255);
param.Value = message.Type;

if (message.Body != null)
{
query += " (@msg)";
param = cmd.Parameters.Add("@msg", SqlDbType.VarBinary);
param.Value = new SqlBytes(message.Body);
param.Size = -1;
}
cmd.CommandText = query;
cmd.ExecuteNonQuery();




This is the code that reads the message from the SQL queue (extracted from Message.cs in ServiceBrokerExample)

m_reader = reader;
m_convGroupId = reader.GetGuid(0);
m_conv = new Conversation(service, reader.GetGuid(1));
m_sequenceNumber = reader.GetInt64(2);
m_serviceName = reader.GetString(3);
m_contractName = reader.GetString(4);
m_type = reader.GetString(5);
m_validation = reader.GetString(6);
if (!reader.IsDBNull(7))
{
SqlBytes sb = reader.GetSqlBytes(7);
Body = sb.Stream;
}
else
Body = null;




This is the MESSAGE TYPE used by this message.

CREATE MESSAGE TYPE CreateReport_Command VALIDATION = None;




Here is the code where msgReceived.Body == null in the SQL CLR method invoked by this message.

[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1062:ValidateArgumentsOfPublicMethods"), System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1822:MarkMembersAsStatic"), BrokerMethod("AssessmentContract", "CreateReport_Command")]
public void CreateReport_Command(
Message msgReceived,
SqlConnection connection,
SqlTransaction transaction)
{
StreamReader reader = null;

try
{
reader = new StreamReader(msgReceived.Body);




And finally here is the code snippet that creates the stream that gets loaded into the message to be sent.

if (Report != null && ReportName != null)
{
MemoryStream ReportBody = new MemoryStream();

if (ReportID == null)
{
ReportID = Guid.NewGuid().ToString();
}

ReportBody.Write(Encoding.ASCII.GetBytes(ReportID), 0, ReportID.Length);
ReportBody.Write(Encoding.ASCII.GetBytes("|".ToCharArray()), 0, 1);
ReportBody.Write(Encoding.ASCII.GetBytes(ReportName), 0, ReportName.Length);
ReportBody.Write(Encoding.ASCII.GetBytes("|".ToCharArray()), 0, 1);
ReportBody.Write(Encoding.ASCII.GetBytes(Report), 0, Report.Length);

Microsoft.Samples.SqlServer.Message request = new Microsoft.Samples.SqlServer.Message("CreateAssessmentReport_Command", ReportBody);

// Send the message to the service
dialog.Send(request, conn, tran);

View 1 Replies View Related

Can't Find Or Load Message DLL. Message DLL Must Be In Path Or In Current Directory.

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

This Message Could Not Be Delivered Because Its Message Timestamp Has Expired Or Is Invalid

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

This Message Could Not Be Delivered Because Its Message Timestamp Has Expired Or Is Invalid.

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

Message Type And Message Body..............

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

Xp_sendmail

Jul 22, 2002

I am trying to use xp_sendmail with no luck. My SQL mail works fine and I am logged in as sa. Here is the csript that I am using. The script works on my local box(which is running Win 2K Advanced Server and SQL 7). It will not work on my production boxes. Any suggestions?

EXEC master..xp_sendmail
@recipients = 'Richard Peoples,
@message = 'Test',
@subject = 'Long-Running Job to Check'


Thanks!!!

View 2 Replies View Related

Xp_sendmail

Mar 27, 2001

Hi,

I am using xp_sendmail in a stored procedure.I need to update the fields after the mail sent. Is there a way to capture the errors or server messages that occurs. I am using the following code.....


select @myquery= 'Execute LeadDistribution..sp_sendmailB ' + convert(char,@AssToID) /*calling the sp_sendmailB procedure */

execute master.dbo.xp_sendmail @recipients='lakshmip@oasisnetwork.com', @message='Leads Information',@query=@myquery

Select @send_Mail=@@Error

If @send_Mail=0
Begin
update MasterleadPool/*Updates the MasterleadPool table once the mail sent */
Set EmailSent='Y', Dateout=getdate()
where AssToID=@AssToID and EmailSent='N' and AssToFlag='Y'
End


I used @@error to capture the error but it does'nt work. I got server message as follows.... So the problem is it should'nt go to update statement if there is any type of errors in sending a mail..

Server: Msg 17903, Level 18, State 1, Line 0
MAPI login failure.

(1 row(s) affected)

Please help me if anyone knows....

Thanks,
Sailaja

View 1 Replies View Related

Xp_sendmail

Dec 21, 2000

Greetings,

I am trying to utilize xp_sendmail passing a variable as the @recipients value.

EXEC master..xp_sendmail
@recipients = @EMAIL_ADDRESS_LNK,
etc.......

However in doing this, it never works (go figure or I wouldn't be submitting this). I have defined the variable @EMAIL_ADDRESS_LNK appropriately to reference a field in a table and I'm positive that the value in the field is valid.

What am I missing? If this is not possible, is there a workaround. Thanks in advance for any assistance you can provide.

View 7 Replies View Related

Xp_sendmail

Jan 9, 2001

Is there anyway to format the message text when using xp_sendmail ?? E.g. making some of it bold or in italics ??

View 1 Replies View Related

Xp_sendmail

Jan 18, 2001

I am using xp_sendmail in stored procedure and sending query using @query option. Is there a way to format the query output?

View 4 Replies View Related

Xp_sendmail

Feb 8, 2000

Hello,

How robust is xp_sendmail? I would like to roll thru 10 - 20 thousand records, strip the email and send a newsletter...

I'm a definite newby when it comes to mail servers (and how they interact with SQL Server 7.0)...so I'm not sure whether this type of processing would crash/stall the server.

can xp_sendmail handle this type of processing?

I appreciate your help,

p.s. can u point me to any good articles on the subject?

View 1 Replies View Related

Xp_sendmail

Mar 14, 2000

Hi
can the receiver list (xp_sendmail parameter) be a query. Becuase i must to concatenate. Thanks

View 1 Replies View Related

Xp_sendmail

Mar 6, 2003

I have a query that works on its own, however when I put
it into xp_sendmail it fails. It appears that the "set"
command does not work. Here is the query. Any suggestions?
Can you use variables within xp_sendmail @ query section?

EXEC master.dbo.xp_sendmail
@recipients = 'Richard Peoples',
@subject = 'The following Budget Checked items need
attention.',
@query ='DECLARE @A1 CHAR (20)
DECLARE @A2 CHAR (2)
SET @A1 = 'Yvette Palomo'
SET @A2 = 'N'
IF (select COUNT (*)
from FSPROD75.dbo.PS_C_JRNLLN_BUDCHK
where RETURN_TO_ANALYST = @A1 AND
BUDGET_CHECK_CLEAR= @A2) > 0
begin
select A.JOURNAL_ID, A.PROJECT_ID, A.ACCOUNT,
B.XLATLONGNAME from FSPROD75.dbo.PS_C_JRNLLN_BUDCHK A
INNER JOIN FSPROD75.dbo.XLATTABLE B ON A.BCM_LINE_STATUS =
B.FIELDVALUE
where (((A.RETURN_TO_ANALYST)= @A1) AND
((A.BUDGET_CHECK_CLEAR)=@A2)) AND (B.FIELDNAME
= "BCM_LINE_STATUS")
end'

View 1 Replies View Related

Xp_sendmail

May 15, 2003

i'm executing this statement:

exec xp_sendmail @recipients='[email add]', @message='hello'

and i get an error 0x80040111

what does that mean? what am i doing wrong?

i'm already using SQL Server authentication. it was working last week, but now it isn't.

help please

View 3 Replies View Related

Xp_sendmail

Jul 18, 2001

Is it possible to set the "From" address using the xp_sendmail procedure?

View 1 Replies View Related







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