Hi, I have a need to shoot and automated mail at regular intervals to clients. I got the following code for sending email from SQL Server but get an error.
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) = 'localhost'
AS
SET nocount on
declare @oMail int --Object reference
declare @resultcode int
EXEC @resultcode = sp_OACreate 'SMTPsvg.Mailer', @oMail OUT
SQL Server blocked access to procedure 'sys.sp_OACreate' of component 'Ole Automation Procedures' because this component is turned off as part of the security configuration for this server. A system administrator can enable the use of 'Ole Automation Procedures' by using sp_configure. For more information about enabling 'Ole Automation Procedures', see "Surface Area Configuration" in SQL Server Books Online.
Hi everyone i get an error messgae running the following code
DECLARE @mailist VARCHAR(max) SET @mailist='' SELECT TOP 1 @mailist=@mailist + email +';' FROM email.dbo.mytable SET @mailist=STUFF(@mailist,LEN(@mailist),1,'') SET @mailist='''' + @mailist + ''''
EXEC msdb.dbo.sp_send_dbmail @profile_name='my_mail_profile', @recipients=@mailist, @subject='mysubject', @body_format='html', @body= ' <html> <head> <title> problems with send_dbmail </title> </head> <body> this is not working </body> </html> '
The error says:
quote:
Syntax error in parameters or arguments. The server response was: 5.5.4 Invalid Address)
At the other hand, if i assign a straightforward @recipints address such as EXEC msdb.dbo.sp_send_dbmail @profile_name='my_mail_profile', @recipients=my@mail.com
Hello, I am using a script to send mails from MSSQL 2000 server. The script is trying to use the ASPMail object is located within a SQL Job or DTS package in the SQL database. It is not being run through an ASP page. The ASPMail object works fine if running in an ASP page running on win2003 server. It DOES NOT work when trying to create the object within SQL ActiveX VB script running on mssql server. If I am using this script in a job and use Microsoft's Enterprise Manager it only tells me that the job failed. If I try to use this script in a DTS package I get the error: 'Can not create object ("SMTPsvg.Mailer"). If I use a third database manager I get the following error: 'Execute permission denied on object xp_ServiceControl database' Please let me know what is causing this and how to fix it. The script goes as below '************************************************* ' Visual Basic ActiveX Script '************************************************* Dim Mailer Set Mailer = CreateObject("SMTPsvg.Mailer") Mailer.FromName = "Webmaster" Mailer.FromAddress = "webmaster@domainname.com" Mailer.RemoteHost = "mail.domainname.com" Mailer.AddRecipient "user", "mailid@domainname.com" Mailer.Subject = "Test ASP Mail" Mailer.BodyText = "Test" x = Mailer.SendMail Set Mailer = Nothing Any help is appreciated Regards
Can anyone help me with a problem I have with SSRS 2005? How do I configure SQL Server 2005 Reporting Services to deliver subscription e-mails to addresses external to my windows domain?
I've been having trouble configuring the Report Server e-mail delivery component to send subscription e-mails to addresses outside the domain on which the report server is hosted.
For e.g. since my local windows domain is named "smartsystems.com", I have found that the Report Manager does not have any problems sending subscription mails to "eawagu@smartsystems.com" but throws up an error whenever I include "eawagu@yahoo.com" in the recipients' list.
when I run a package from a command window using dtexec, the job immediately says success. DTExec: The package execution returned DTSER_SUCCESS (0). Started: 3:37:41 PM Finished: 3:37:43 PM Elapsed: 2.719 seconds
However the Job is still in th agent and the status is executing. The implications of this are not good. Is this how the sql server agent job task is supposed to work by design.
We just moved source server to newer, bigger box ... Windows 2003 and Active Directory ... Snapshot agent worked but distribution failed ... Same login as on older machine, login is sysadm, used DCOMCNFG to allow ability to launch process ... What are we missing?
I have a SQL server though a hosting company and I am trying to send autoemails using xp_sendmail. The permissions were set and I used the following command to test it.
Hi everyone i get an error messgae running the following code
DECLARE @mailist VARCHAR(max) SET @mailist='' SELECT TOP 1 @mailist=@mailist + email +';' FROM email.dbo.mytable SET @mailist=STUFF(@mailist,LEN(@mailist),1,'') SET @mailist='''' + @mailist + ''''
EXEC msdb.dbo.sp_send_dbmail @profile_name='my_mail_profile', @recipients=@mailist, @subject='mysubject', @body_format='html', @body= ' <html> <head> <title> problems with send_dbmail </title> </head> <body> this is not working </body> </html> '
The error says: quote:Syntax error in parameters or arguments. The server response was: 5.5.4 Invalid Address) At the other hand, if i assign a straightforward @recipints address such as EXEC msdb.dbo.sp_send_dbmail @profile_name='my_mail_profile', @recipients=my@mail.com It works Anybody know why ? Thanks
I'm using xp_sendmail in the sp and in @query I do select * from table1. The result also page,s The formate is not at all readable and even if @attach_results = 'TRUE' In the text file its not formatted as it sends mail to my manager I want it to be formatted and looks good. Can anyone help me or Is there any way to get the results in readable format.
I need to assemble information from my outlook account into a database table. Is it possible to insert "title" of a set of mails recieved into a table ? sender's name ? recipient's name? body? etc...
Hi I have created a Percent Log Used Alert with a threshold of 85% and am getting e-mailed with Database Mail, the problem is that I continue to get e-mailed repeatedly with the same e-mail until I disable the Alert. Is there any way to have it just e-mail it once?
How can I set the default body_format in database mail. I would like to send a warning with plain text format (from the alerts), that i'll get on my mobile phone, but the message's format is html... always...and I don't get the sms-s.
I am testing the e-mail subscriptions to my hotmail account in anticipation of sending e-mail reports to our business partners. I have made the following to the RSreportserver.config file:
Function Main() const SMTP_SERVER = "MPBAKOREX01.corp.mphasis.com"
set iMsg = CreateObject("CDO.Message") set iConf = CreateObject("CDO.Configuration") Set Flds = iConf.Fields
With Flds .Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = cdoSendUsingPickup .Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = SMTP_SERVER .Item("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 90 .Update End With
With iMsg Set .Configuration = iConf .To = "ausrg@yahoo.com" .From = "shanmuga.r@mphasis.com" .Subject = "TEST" .HTMLBody = "jfldsajfldk;sajf ;lksadjf;lkasdjlfkjasdlkfjlasdkj flkdsajflsadjf ljasdlf a" .Send End With
Main = DTSTaskExecResult_Success End Function
When i am executing this , i am getting the following error :
Error Source : Microsoft Data Transformation Services (DTS) Package
Error Description : Error Code: 0
Error Source= CDO.Message.1
Error Description: The "SendUsing" configuration value is invalid.
Hello All,I wrote one code for sending mail by using Asp.Net+C#, My code is asfollows.private void btnSend_Click(object sender, System.EventArgs e){try{MailMessage email = new MailMessage();if(rblHtml.Checked){email.BodyFormat=MailFormat.Html;}if(rblText.Checked){email.BodyFormat=MailFormat.Text;}email.From=txtSender.Text;email.To=txtReceiver.Text;email.Subject=txtSubject.Text;email.Body=txtBody.Text;string attach1=null;if(opdAttachment1.PostedFile !=null){HttpPostedFile ulFile=opdAttachment1.PostedFile;int nFileLen=ulFile.ContentLength;if(nFileLen>0){strFileName=Path.GetFileName(opdAttachment1.Posted File.FileName);strFileName="attachment/"+strFileName;opdAttachment1.PostedFile.SaveAs(Server.MapPath(st rFileName));MailAttachment attach=newMailAttachment(Server.MapPath(strFileName));email.Attachments.Add(attach);attach1=strFileName;}}SmtpMail.SmtpServer="127.0.0.1";SmtpMail.Send(email);if(attach1 !=null){File.Delete(Server.MapPath(attach1));}lblMessage.Text="Your email has been sent successfully";catch(Exception ex){lblMessage.Visible=true;lblMessage.ForeColor=Color.Red;lblMessage.Text=ex.ToString();}When i press "SEND" button, the mail is delivered and i receive message"Your email has been sent successfully". But the mail is not deliver totarget destination.The Mail is stored in "C:Inetpubmailrootqueue" folder. After sometime, it is autometically stored in "Badmail" folder.I use Windows 2000 Professional+.net 1.1 version.I need some solution ... I am relatively new in .net .. Can anybodyhelp me please..
I am new to SQL Server 2005, I need Help to create a SSIS package for the below taks, My task is Refer a Column [Status] in the Logtable which is used to maintain the logs for the running processes, When ever any Rows with the "FAIL" status in Status column occurs in the LogTable then get the Respective ErrorRowNumber and get the Details of the Error from other 2, 3 tables which will be a simple SQL statements, when you get the Error Details then mail these details to the given Email id.
For this I need a help In creating a SSIS package which will continuously check the Status and if any FAIL status occurs then the Error details need to mail to mail id which are stored in the config files of SSIS package.
If any one has better idea to send the mails then please let me know.
if any online tutorial is available that will also help. Thanks in advance
I am new to SSIS. I have a requirement that from a flat file need to import the data into SQL Server DB(SQl Server2008r2).
1.When the file doesn't found in dir need to send a mail. 2.error reading And writing ,on which record the error occurred and capture the error details and need to send mail. 3. In success also need to send a mail.
I am having a few problems with Database Mail and wondered if anyone could assist. It sends test mails fine, but when I run the following script:
(I've changed my email address in this post to test@test.com they are accurate in the scripts.)
EXEC msdb.dbo.sp_send_dbmail
@profile_name = 'Test Mail',
@recipients = 'test@test.com',
@body = 'Sent by sp_send_dbmail',
@Subject = 'SQL Server Email Test Email';
It gives the following errors.
(from the above script)
mailitem_id = 16 profile_id = 2 recipients = test@test.com copy_recipients = NULL blind_copy_recipients = NULL subject = SQL Server Email Test Email body = Sent by sp_send_dbmail body_format = TEXT importance = NORMAL sensitivity = NORMAL file_attachments = NULL attachment_encoding = MIME query = NULL execute_query_database = NULL attach_query_result_as_file = 0 query_result_header = 1 query_result_width = 256 query_result_separator = exclude_query_output = 0 append_query_error = 0 send_request_date = 2008-04-15 10:50:03.827 send_request_user = COMPANYTest.Test sent_account_id = NULL sent_status = failed sent_date = 2008-04-15 10:50:04.000 last_mod_date = 2008-04-15 10:50:04.513 last_mod_user = sa
(from the test mail)
mailitem_id = 11 profile_id = 2 recipients = test@test.com copy_recipients = NULL blind_copy_recipients = NULL subject = Database Mail Test body = This is a test e-mail sent from Database Mail on UKDEVSQL1 body_format = TEXT importance = NORMAL sensitivity = NORMAL file_attachments = NULL attachment_encoding = MIME query = NULL execute_query_database = NULL attach_query_result_as_file = 0 query_result_header = 1 query_result_width = 256 query_result_separator = exclude_query_output = 0 append_query_error = 0 send_request_date = 2008-04-15 09:51:46.530 send_request_user = COMPANYTest.Test sent_account_id = 4 sent_status = sent sent_date = 2008-04-15 09:51:46.000 last_mod_date = 2008-04-15 09:51:46.610 last_mod_user = sa
sysmail_event_log gives this error for mail item 16 (the scripted email):
The mail could not be sent to the recipients because of the mail server failure. (Sending Mail using Account 4 (2008-04-15T10:11:41). Exception Message: Cannot send mails to mail server. (Mailbox unavailable. The server response was: 5.7.1 Requested action not taken: message refused). )
I would appreciate any help here at all. I am pulling my hair out!
I am unable to start the snapshot agent or log reader agent from within SQL management studio. it fails on executing step 2 with unknown username or bad password.
I have checked all account details and they are correctly using my domain admin account. I can connect to SQL using teh same account and it also has sysadmin permissions.
If i copy the step 2 paramters and start from the cmd prompt (again logged in using the same domain account) they both start fine.
I am testing peer to peer replication in our environment. I simulated a three node peer to peer topology and a local distributor.
For some wierd reason I cannot get the Log Reader Agent and snapshot agent to start. The domain account under which SQL Server Agent runs has administrator previlage on the box. I also use a domain account for SQL Server Service. (none of the passwords changed).
This is the error I am getting - "Executed as user: abc. A required privilege is not held by the client. The step failed"
While I was out of the office the Lan Team moved one of my SQL Server2000 servers to a new network domain. Since then the maintenance jobhas not ran.The error log for the SQL Agents has the message listed in the subjectline. I have not found any useful articles on the MS SQL Serversite. Anyone know what might be wrong and how to fix it.HTH -- Mark D Powell --
Hi. I have installed an SQL 2005 Failover Cluster on a Two Node Active Passive Windows 2003 Cluster.If i am trying to failover from the Active node to the passive Node,The Sql Server,Sql Server Agent and SQL Analysis resources fail,However if i reset the passowrd in the services tab of the above three services on the pasive node,the resources come online. Below is the brief of my setup 1.I have two Active directory domain controllers running Windows 2003 R2 Standard edition with SP2. 2.i have installed a Windows 2003 Two Node Active Passive Cluster as NODE1 and NODE2. 3.The Domain account used to install WIndows 2003 A/P Cluster is Clusteradmin.This account is the member of Administartors on the Domain as well as the Local Admin on NODE1 and NODE2. 4.SQL 2005 with SP2 is installed on both the Nodes as SQL 2005 Failover Cluster.The account used to install SQL 2005 is sqadmin.This account is the member of Administartors on the domain and the member of Local Admins on NODE1 and NODE2. 5.SLQ 2005 has four domain groups for 4 SQL Services.The Services are SQL Server,SQL Server Agent,SLQ Anaylisis Server and Full text Search. 6.Each of these servcie has a seperate service account created for them.All these service accounts areb the members of domain admin and the member of Local Admin on NODE1 and NODE2. 7.Each of these servcies is running under these servcie accounts in the Servcies tab in NODE1 and NODE2. 8.If i fail the resources from NODE1 to NODE2 ,The SQL Server,SQL Server Agent and SQL Anaylisis resources are failing.on going to the service tab of NODE 2 I reset the password for these services,the services come online. 10.The Cluster resources and MSDTC Resources are Failing over successfully.They are coming online successfully. 11,I have a problem with the SQL Server Resources,even if i failback to NODE1 from NODE2,the same resources are failing again.
Is there a difference with sql replication between sql server 2005 64bit and sql server 2005 32bit? Both are on a Windows 2003 server. One is 32 bit and the other one is 64 bit. The first time I set up sql replication (test environment), it was on a 32 bit sql server. This worked fine. The second time I wanted to set up replication (live environment), it was on a 64 bit sql server. This didn't worked fine.
I can't call the sqlcesa30.dll file on the 64bit server with IIS. So I called the dll via a remote IIS server. This worked but gave me the following error when calling the following URL: http://domain/PDASYNC/sqlcesa30.dll?diag
SQL Server Mobile Server Agent Diagnostics 2007/07/31 14:26:55
General Information
Item Value
Server Name domain
URL /PDASYNC/sqlcesa30.dll
Authentication Type Anonymous
Server Port 80
HTTPS off
Server Software Microsoft-IIS/6.0
Replication Allowed
RDA Allowed
Logging Level 0
Impersonation and Access Tests
Action Status ErrorCode
Impersonate User SUCCESS 0x0
ReadWriteDeleteMessageFile FAILURE 80070003
SQL Server Mobile Modules Test
Module Status ErrorCode Version
SQLCERP30.DLL SUCCESS 0x0 3.0.5207.0
SQLCESA30.DLL SUCCESS 0x0 Unknown
Reconciler Test
Reconciler Status ErrorCode
9.0 Database Reconciler SUCCESS 0x0
8.0 Database Reconciler FAILURE 0x8007007E
SQL Server Module Versions
Module Version
sqloledb.dll 2000.86.1830.0
9.0 replrec.dll 2005.90.2047.0
9.0 replprov.dll 2005.90.2047.0
9.0 msgprox.dll 2005.90.2047.0
8.0 replrec.dll 2000.80.760.0
8.0 replprov.dll 2000.80.760.0
8.0 msgprox.dll 2000.80.760.0
After seeing this I looked up what ReadWriteDeleteMessageFile could mean. It appeared to be some NTFS acces problem. But when I checked the security settings, it all seemed to be ok.
Has anyone any idea what else to check? Or is sure that I must have done something wrong?
Sql server agent is running under a domain account that is a member of administrators and domain users amongst others, and the package is executed as the service account. Connecting to servers on the same domain works and when I run it from the msdb package store in ssis (ssis runs under the network service account ...) it will connect to the pop server as well. Permissions, fiddly proxies .. the answer's out there somewhere
The SQL Server Agent (MSSQLSERVER) service on server started and then stopped. If i Manually start the services also SQL Server Agent services are stopping automatically.Though I selected Auto Restart SQL Server Agent if it stops unexpectedly, The services are stopping automatically.TCP/IP protocol was enabled for port 1433.Are there any setup I missed?
Hello everyone !!! I need to do a process that run every day to update some data, but my sql server version (express 2005) does not have job agent service. Does anyone can give me a suggestion of what to do? Thank you!
Hi there, was wondering if any can tell me why the following jobs keeps failing: INSERT INTO TblActivityBookingArchive SELECT * FROM TblActivityBooking WHERE (expiryDate <= GETDATE()) it retuens that it is successful when there is no data to archive from TblActivityBooking, it's when there is data to archive that it returns that the job has failed. Hope you can help Thanks Mel
I am unable to start SQL Server Agent. When I try, I get this message: "An Error 1053 - (The service did not respond to the stort or control request in a timely fashion) occurred while performing this service operation on the SqlServerAgent service."