SQL Mail Sending Attachment Of Data From A Table!

Mar 29, 2001

Ok i have a programmer who wants to send out the data from a table as an email attachment via sql mail without having to write a com component. Does any one know the procedures on how to do this (i.e stored procedures and triggers ect and anything else i need or should know).

Please dont answer this unless you have some genuine help as I dont want to post this every time someone comes up with a smart ass comment!
Thanks guys

View 1 Replies


ADVERTISEMENT

Sending Mail With Attachment

Mar 27, 2008



Dear Gurus

I have got a requirement.

I need to send mail with an attachment.

for eg.

An employee has requested leave a mail should go to the person he is reporting to as a mail and with this mail
an attachment of the leave request should be sent.

When the person who recevies mail he opens the attahcment and apporves the leave request or rejects a return mail to go to all concerned.

View 3 Replies View Related

Sending Images Through Database Mail From Table

Oct 14, 2015

I have one table the image column  contains pictures based on  image datatype. If the  user upload the image  from the form, the image was  stored in  the table  its working fine and I did.

Here I want  at the same time, the inserted image is  sending  mail to receptionist in the background.

View 6 Replies View Related

Integration Services :: Sending Mail With HTML Format In Send Mail Task

Aug 18, 2015

I have to send mail with HTML format  and attaching multiple files dynamically via send mail task.

View 10 Replies View Related

SMTP Database Mail Showing Error While Sending Mail

Mar 7, 2007

Lokendra writes "I have configured the Database mail profile and account in Sql Server 2005 but the mail is not sending and showing the following error message:

Error,235,The mail could not be sent to the recipients because of the mail server failure. (Sending Mail using Account 1 (2007-03-05T15:16:07). Exception Message: Cannot send mails to mail server. (Mailbox name not allowed. The server response was: Sorry<c/> that domain isn't in my list of allowed rcpthosts.).
),3000,90,,3/5/2007 3:16:07 PM,sa


but while in the same mail set up in previous instance of sql server 2005 the message was sending very well. After installing new instance of sql server 2005 the problem is arising.


Anybody can tell me that what I can do so that i can send mail using the SMTP databasemail account."

View 1 Replies View Related

SSIS Send Mail Task - Failure Sending Mail

Dec 13, 2007

Dear all,
I have switched off the firewall settings on my system and as suggested im entering the minimal information and data to send the mail.
but still the Mail Task is failing..
plz suggest.

View 11 Replies View Related

SSIS Send Mail Task - Failure Sending Mail

Jun 8, 2006

Hi Everyone,

Hopefully someone out there will have an idea as this is driving me nuts.

I've setup a task to email on success/failure and keep receiving the following message when executed:

Progress: The SendMail task is initiated. - 0 percent complete
[Send Mail Task] Error: An error occurred with the following error message: "Failure sending mail.".
Progress: The SendMail task is completed. - 100 percent complete
Task Send Mail Task failed

When I configure Outlook Express on the same machine with the same settings it works.

On the SMTP Connection Manager I have left the default name, tested with both an IP address and Server Name, and no authentication or SSL.

On the Send Mail Task, it uses the above connection. The To: , From: , Subject fields are populated. Message SourceType is DirectInput, MessageSource is Test, Priority is Normal and no attachments or expressions etc.

Nothing useful is logged in the Event Viewer even with full logging turned on.

Any suggestions appreciated,

Thanks.









View 11 Replies View Related

Error Sending Mail With Send Mail Task

Feb 6, 2008

I keep getting a generic "Error Sending Mail" error. For testing purposes I am just trying to send using my own email account. What goes in the SMTP Server box in the connection manager? I have tried:

A - the exchange server address (SOMETHING.us.company.com)
B - The SMTP properties I see when I look at the properties of my email address: (my.name@abcd.efgh.company.com)
C - Just the end portion of the SMTP properties: (abcd.efgh.company.com)
D - My email address (my.name@company.com)

I don't know what to enter, or what is giving me such a generic error message.

View 7 Replies View Related

Sending Mail To Several Users With Send Mail Task ?

Nov 10, 2006

I know you can specify additional recipients in the To column by sepperating them with a semicolon. But whats the easiest way to send to several users, when the email address must be retrieved from a table with a query like this:

select email from problem_subscribers

where project = 'project1'

and statusmail = 'OnError'

So when the eventhandler gets an OnError i want the mail task to be sent to each problemsubscriber.



View 3 Replies View Related

Sql Mail W/attachment

Sep 19, 2001

I'm trying to use the xp_sendmail and include a txt file as an attachment.
I can't get the procedure to work with the attachment.....any help would be greatly appreciated. this is what I have been trying to get to work.....Thanks!! Scott



exec master.dbo.xp_sendmail
@recipients = 'xyz@email.com',
@query = 'SELECT * FROM ape_pt_temp',
@subject = 'SQL Server Report',
@message = 'file attached',
@attach_results = 'true', @width = 250

View 1 Replies View Related

E-Mail Attachment

Mar 27, 2007

I wrote a procedure in Sql Server 2000 which sends an E-Mail to any E-Mail account. But I not able to send an attachment with the E-Mail. I dont have the code for attachment in the same procedure, as I searched on Google I not able to find out. Please help me for the same.
Waiting for your reply.

View 3 Replies View Related

Mail Attachment With CDOSYS

Feb 27, 2006

Hi,
I am using the following stored procedure to send a mail with attachment. But the mail is sent without the attachment. Can anyone help me?

CREATE PROCEDURE DBO.sp_Send_Mail_test(
@p_From as nvarchar(50),
@p_To as nvarchar(50),
@p_Subject as nvarchar(255),
@p_Body as varchar(1000),
@p_CC as text = null,
@p_BCC as text = null,
@p_Attachment varchar(500)=null
)
AS
Declare @Message int
Declare @hr int
Declare @source varchar(255)
Declare @description varchar(500)

EXEC @hr = sp_OACreate 'CDO.Message', @Message OUT

EXEC @hr = sp_OASetProperty @Message, 'From',@p_From

EXEC @hr = sp_OASetProperty @Message, 'To', @p_To

EXEC @hr = sp_OASetProperty @Message, 'Subject', @p_Subject

EXEC @hr = sp_OASetProperty @Message, 'TextBody', @p_Body

EXEC @hr = sp_OAMethod @Message, 'CDO.Message.Attachment.Update', Default, @p_Attachment

If @p_CC is not null
BEGIN
EXEC @hr = sp_OASetProperty @Message, 'CC',@p_CC
END

If @p_BCC is not null
BEGIN
EXEC @hr = sp_OASetProperty @Message, 'BCC',@p_BCC
END

EXEC @hr = sp_OAMethod @Message, 'Send', NULL

EXEC @hr = sp_OAGetErrorInfo NULL, @source OUT, @description out


EXEC @hr = sp_OADestroy @Message
IF @hr <> 0
BEGIN
SELECT hr=convert(varbinary(4),@hr), Source=@source, Description=@description
RETURN
END

Regards,
Bharathram G

View 1 Replies View Related

SQL Mail With Attachment Not Working

Apr 22, 2004

Hi,

I am able to send normal mails from SQL Server with no attachments.

But when i am trying to send mail with an attachment i get following error.

Server: Msg 18025, Level 16, State 1, Line 0
xp_sendmail: failed with mail error 0x80004005

I am running SQL Server 2000 , SP3.

select @@version
---------------------------------
Microsoft SQL Server 2000 - 8.00.760 (Intel X86) Dec 17 2002 14:22:05 Copyright (c) 1988-2003 Microsoft Corporation Standard Edition on Windows NT 5.0 (Build 2195: Service Pack 4)



exec master..xp_msver
------------------------------------------
Index Name Internal_Value Character_Value
------ -------------------------------- -------------- ------------------------------------------------------------------------------------------------------------------------
1 ProductName NULL Microsoft SQL Server
2 ProductVersion 524288 8.00.760
3 Language 1033 English (United States)
4 Platform NULL NT INTEL X86
5 Comments NULL NT INTEL X86
6 CompanyName NULL Microsoft Corporation
7 FileDescription NULL SQL Server Windows NT
8 FileVersion NULL 2000.080.0760.00
9 InternalName NULL SQLSERVR
10 LegalCopyright NULL © 1988-2003 Microsoft Corp. All rights reserved.
11 LegalTrademarks NULL Microsoft® is a registered trademark of Microsoft Corporation. Windows(TM) is a trademark of Microsoft Corporation
12 OriginalFilename NULL SQLSERVR.EXE
13 PrivateBuild NULL NULL
14 SpecialBuild 49807360 NULL
15 WindowsVersion 143851525 5.0 (2195)
16 ProcessorCount 1 1
17 ProcessorActiveMask 1 00000001
18 ProcessorType 586 PROCESSOR_INTEL_PENTIUM
19 PhysicalMemory 254 254 (266850304)
20 Product ID NULL NULL

(20 row(s) affected)



Any help would be helpful.

Regards
Jay

View 2 Replies View Related

Problem With Sending Mail Via Database Mail

Mar 9, 2007

Hi every body


I want to send a simple mail using DATABASE MAIL feature in SQL SERVER 2005.

I've defined a public profile.
I've enabled Database Mail stored procedures through the Surface Area Configuration .

but   I can't send a mail with sp_send_dbmail stored procedure in 'msdb' database .


when I execute sp_send_dbmail in the Managment Studio  the message is
"Mail queued"  but the mail is not sent.

Could it be related to Service Broker?Because  the Surface Area Configuration indicates:'this inctance does not have a Service Broker endpoint'.If so, how should I make an endpoint?

here is the log file after executing sp_send_dbmail:


1)  "DatabaseMail process is started"

2)   "The mail could not be sent to the recipients because of the mail server failure. (Sending Mail using Account 2 (2007-03-08T00:49:29). Exception Message: Could not connect to mail server. (No connection could be made because the target machine actively refused it)."

 The DatabaseMail90.exe is triggred ,so the mail is transfered to the mail queue but  DatabaseMail90.exe couldn't give the mail to SMTP server.The promlem is what should I do to make DatabaseMail90.exe able to connect to  the server?



please help me.

POUYAN

View 21 Replies View Related

E-mail In SSRS Reports With Attachment

Mar 13, 2007

Hi All,

In my SSRS report there is a column with email field, when the user clicks on it -- it should open the outlook and in the attachment field there should be a screenshot of that report

i think anything i could do is only in the jump to url in the navigation tab......Please suggest me the solution or any other alternatives.

Thanks in advance for help

Warm Regards,

Chanduu.

View 1 Replies View Related

Send Mail Variable Attachment

Jul 16, 2007

I am able to use a variable filename in my send mail task as the message source when I specify variable as the message source type. But I would rather use the variable in the attachment e.g. @[User::filename].



When I do that, I get the message that the file doen't exist. How is it possible to specify a variable as the attachment?



Den

View 7 Replies View Related

VS 2003 - Count Rows In Excel E-mail Attachment?

Jan 4, 2007

I have a C# program that sends an e-mail with an Excel attachment. The Excel file is populated with the results of a SQL stored procedure before the e-mail program is executed. The entire process is in a DTS package (populate a temporary table, export the table to Excel, then send the e-mail). It is possible that the stored procedure will return no results, in which case the Excel file will not be populated.I'd like to know whether it is possible (and if so, how) to add some code to my e-mail program that will count the number of populated rows in the Excel file and if that number is <2 (the header row will always be populated), to quit and not send the e-mail.

An alternative would be for the DTS package to terminate if the stored procedure returns 0 records.

Thanks!

View 3 Replies View Related

SQL Mail - Problems With Sending A Mail

Oct 14, 1999

Hi.
I have problems with sending a mail from SQL Server:
SQL Mail starts.
Command: xp_sendmail 'MRudyk','Halo!'
returns:Unknown recipient: Parameter '@recipients', recipient 'Mrudyk'
'Mrudyk' is valid recipient...

View 2 Replies View Related

SSIS SEND MAIL TASK EXCEL ATTACHMENT TIME OUT

Mar 3, 2008

HI !

I need help to fix SSIS Send Mail Task Error.
I have a

Data Flow
Read from Sql Data base and then put the query result into excel file
(OLE DB Source --> Excel Destination)

Send Mail Task
Email excel file from the data flow

Control Flow :
Data Flow --> Send Mail Task

The package throws an error below. I tried to disable my antivirus because i thought it's throwing an error because of the antivirus.
But, it's still throwing the same error. If i tried to send email without attachment, it works just fine.
Is there anybody know how to fix this?

Progress: The SendMail task is initiated. - 0 percent complete
[Send Mail Task] Error: An error occurred with the following error message: "The operation has timed out.".
Progress: The SendMail task is completed. - 100 percent complete
Task Send Mail Task failed

View 3 Replies View Related

DB Engine :: Send Query Result As Excel Attachment With Database Mail?

Aug 12, 2015

I have below table in the snapshot, My task is to send the same output as a attachment in Excel to email. i used the below procedure
 
EXEC [msdb]..sp_send_dbmail 
@profile_name='TSSSendMail',
@recipients='mymailID@gmail.com.com',
@subject='DB Mail',
@body='HI Team',
@execute_query_database = 'DbName',
@query = 'EXEC J16ReimbursementFortnightly1TO15 1',
@attach_query_result_as_file=1,
@query_attachment_filename = 'SummaryReimbursement.xls'

But I am not getting Proper Output, is seems like CSV Format, but i want it proper tabular format in Excel.

View 4 Replies View Related

Sending Mail Through SP

Mar 28, 2008

I have written a stored procedure which should send mail from the stored procedure in sql server 2005. Here is the SP
set ANSI_NULLS ONset QUOTED_IDENTIFIER ONgo
ALTER Procedure [dbo].[sp_SMTPMail]
@SenderName varchar(100),@SenderAddress varchar(100),@RecipientName varchar(100),@RecipientAddress varchar(100),@Subject varchar(200),@Body varchar(8000),@MailServer varchar(100) = 'smtp.mail.tspl.com'
AS
SET nocount on
declare @oMail int --Object referencedeclare @resultcode int
EXEC @resultcode = sp_OACreate 'SMTPsvg.Mailer', @oMail OUT
if @resultcode = 0BEGINEXEC @resultcode = sp_OASetProperty @oMail, 'RemoteHost', @mailserverEXEC @resultcode = sp_OASetProperty @oMail, 'FromName', @SenderNameEXEC @resultcode = sp_OASetProperty @oMail, 'FromAddress', @SenderAddress
EXEC @resultcode = sp_OAMethod @oMail, 'AddRecipient', NULL, @RecipientName, @RecipientAddress
EXEC @resultcode = sp_OASetProperty @oMail, 'Subject', @SubjectEXEC @resultcode = sp_OASetProperty @oMail, 'BodyText', @Body
EXEC @resultcode = sp_OAMethod @oMail, 'SendMail', NULL
EXEC sp_OADestroy @oMailEND
SET nocount offexec sp_smtpmail 'ramana','venkataramanaiah.uppalapati@tspl.com','rajan','ramana.u@gmail.com','test','This is a sample message'
when i execute the SP by giving the following input parameters like
exec <spname> 'rajan', 'rajan.crp@tspl.com', 'venkat', 'venkat@tspl.com', 'test', 'Test Message' 
It ran successfully but the recepient venkat@tspl.com did'nt receive any mail from rajan.crp@tspl.com
I used the following commands for configuring OLE Automation Procedures
exec sp_configure 'Show

View 4 Replies View Related

Sending Mail

Apr 27, 2000

I am having a problem with SqlServer 7.0 sending mail when the sqlserver account is not logged into the machine and mail is open. If I log off of the box and an alert sends mail it just sits in the outbox of the mail client until I log in. Is this the way it is supposed to be or am I doing something wrong. I am using the Inbox as my client.

Thanks

Tom Goltl

View 1 Replies View Related

Sending SQL Mail

Jul 22, 2006

Hi,

I am using SQL Server 2005. I have configured my email on Database Mail. when I am trying to send email using xp_sendmail I am getting problem error as:

Msg 17925, Level 16, State 1, Line 0

xp_startmail: failed with mail error 0x80040111

I am using following sql statement

master.dbo.xp_startmail 'myaccount','mypwd'

master.dbo.xp_sendmail 'tomail1@mail.co.in','test'

where myaccount and mypwd is my password on my email profile.'tomail1@mail.co.in' is the destination email address..

thanks

View 15 Replies View Related

Sending E-mail On SP Action

Jun 18, 2008

Hello all,
I've run into a situation which I'm not sure which option to use. I have a web-based app that needs to send an email to a user once an auction has ended (the user being the winning bidder). The backend of the app is SQL 2005. I'm trying to figure out how to get this to work but I'm not sure if I should be using Database Mail or if I should be using a windows service on the web server that pings the database to check if the auction has ended and if the user has been notified. Can anyone shed some light as to which way I should be doing this? Additionally, I'm planning on formatting the style of the mail message so it'll need to be in HTML format and not plain text.
Any help is greatly appreciated.
Regards,
Axel

View 17 Replies View Related

Sending Mail Through SQL Server

May 9, 2001

I need help regarding how to send mails through SQL server. Let me give you some more details: I am having a table where in all the e-mail id's are stored so i need to write a stored procedure that will pick up the email id from the table and it has to send the mail once you run the stored procedure.
Any help in this regard will really help...pls help me out...

View 1 Replies View Related

Problem Sending Mail

Aug 25, 2000

Hi,

I have few DTS package schedule on my SQL Server 7. When the DTS fail, it's supposed to send an e-mail to me. But, for an unknown reason, the server send me some e-mail to report the failure of the DTS and suddenly...nothing. The server stop sending e-mail to report the failure of the DTS package. I decided to restart the Server and... i receive over 300 e-mails that i was supposed to receive 3 week ago about the failure of the DTS package. It's not the first time that this problem occur and everytime i need to restart the server, now i am tired of that.

Does anyone have see this problem before?

Martin

View 1 Replies View Related

Problem In Sending Mail

Jun 9, 2008

Hai to all.,
Im trying to send mail from Sql server but my efforts were ended in vain can any one help me on this.,
I have done the coding lik this..
step 1:
use master
go
sp_configure 'show advanced options',1
go
reconfigure
go
sp_configure 'Database Mail XPs',1
go
reconfigure
go

Step 2:
EXECUTE msdb.dbo.sysmail_add_account_sp
@account_name = 'Admin', -- Account Name on SMTP (User Defined)
@description = 'Mail Account for Database Mail',-- Account mail description. (User Defined)
@email_address = 'chandrubrave@gmail.com',-- Mail sender E-mail address (User Defined)
@display_name = 'Admin', -- Mail Sender display name, which displays, when mail received by recipient (User Defined)
@username= '', -- SMTP Sever User Name
@password='', -- SMTP Server Password
@mailserver_name = '190.160.110.50' -- SMTP Server Address'.

step 3:
EXECUTE msdb.dbo.sysmail_add_profile_sp
@profile_name = 'New profile',
@description = 'Profile used for database mail'

Step 4:
EXECUTE msdb.dbo.sysmail_add_profileaccount_sp
@profile_name = 'New profile',
@account_name = 'New Admin',
@sequence_number = 1

Step 5:
EXECUTE msdb.dbo.sysmail_add_principalprofile_sp
@profile_name = 'New profile',
@principal_name = 'public',
@is_default = 1 ;

Step 6:
declare @body1 varchar(100)
set @body1 = 'Server :'+@@servername+ ' My First Database Email '
EXEC msdb.dbo.sp_send_dbmail @recipients='chandramohanc@zylog.co.in',
@subject = 'My Mail Test',
@body = @body1,
@body_format = 'HTML' ;

I have got a response like --Mail queued.

But i dint get any mail and also in msdb.dbo.sysmail_event_log table have got an entry with description fails ..
Sorry for posting such a long post..

Thanks In advance

View 2 Replies View Related

Sending Mail Issues

Feb 24, 2007

Hi All,
I'm trying to send mail from sql server I searched the net and i have some things needs calrification and help

What is the difference between sqlmail and sql agent mail ?

is it possible to use and configure them with out having OutLook installed on the server?

when creating a mail profile to be used by SQL mail this profile must be created under the account that runs SQL SERVER Service .. must this account be authenticated under Exchange server if i connect to it ??

to connect to Microsoft Exchange Server can i use the XPSMTP or i have to use SQL MAIL ??

Too much questions i Know but i appreciate your help any way

View 3 Replies View Related

Sending Mail From Sql Server?

Jun 11, 2007

Hi,

i want to send Mail from sql server.which means that when i execute an query a mail will send to mentioned e-mail.is it any predefined function is there?.if,yes,can u explain Detail.

Regards
Umapathy

View 2 Replies View Related

Sending Mail In Blocks

Jun 12, 2007

I need to find a way to send mail in blocks of 100 and 500 at intervals of 120 seconds. Does anyone know of any code for this?

Thanks!

Etymon

View 4 Replies View Related

Sending Mail From Sqlserver2005

Jun 29, 2007

Hi,

I have 0 experience with SQLMail, and I don't want to go too deep into it as I already am trying to learn more than I can with the other parts :) I'm wondering, is there an easy way to have SQL Email me when anything strange happens with the SQL server? It would be awesome to get alerts to my phone.

Thanks very much
mike123

View 4 Replies View Related

Sending Database Mail

Feb 14, 2008

Hi,

I have the table like

Id Pickuptime
1 2008-02-14 13:07:06.317

If the record is inserted to the above table that would look at a pickuptime field in a table and if pickuptime is 2008-02-14 13:07:06.317 after 6 hour from the pickuptime then I would send a email to briteindia_kumar@hotmail.com

How i would do this would any one help to me.

Thanks
kumar

View 2 Replies View Related

Sending E-mail Using @UserName Parameter

Oct 14, 2006

I am creating a membership site. I’d like to be able to have members be able to send customized e-mail to their own individual e-mail list. In creating the mail function (at least just a simplified version so I can get the basics to work), I’m using a select statement that uses @UserName as a parameter in the WHERE clause. I can’t get this work, however, and one of the error messages I get says “must declare the scalar variable '@UserName'". Below is the code I’ve come up with, which may be far off. I'm new to programming so please keep that in mind. I’m using Visual Studio 2005 and SQL Server 2005. If anyone has any suggestions, I’d really appreciate it! Thank you.Imports System.Net.MailImports System.Data.SqlClientImports System.Web.UI.WebControlsImports System.WebPartial Class emailInherits System.Web.UI.PageProtected Sub btnSend_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnSend.ClickDim MyEmail = New MailMessageDim MyClient = New SmtpClient("localhost")Dim FromAddress = New MailAddress(Profile.Email)MyEmail.From = FromAddress'-- Create MailAddresses from a database'-- Open a database connectionDim DBConnection = New SqlConnection( _"Server=localhost; Integrated Security=True; database=WebSite18database")DBConnection.Open()Dim SQLString As StringDim SelectParameters = New Data.SqlClient.SqlParameter("@UserName", Data.SqlDbType.VarChar)SQLString = "SELECT [UserName], [ClientFirstName], [ClientLastName], [CleintEmail], [ClientID] FROM [Clients] WHERE ([UserName] = @UserName)"Dim DBCommand = New Data.SqlClient.SqlCommand(SQLString, DBConnection)'-- Retrieve a recordset of selected records from the databaseDim DBReader As SqlDataReader = DBCommand.ExecuteReader()While DBReader.Read()Dim ToAddress = New MailAddress(DBReader("ClientEmail"))MyEmail.To.Add(ToAddress)End WhileDBReader.Close()DBConnection.Close()MyClient.Send(MyEmail)End SubEnd Class

View 2 Replies View Related







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