Results 1 to 4 of 4
  1. #1
    Join Date
    Feb 2004
    Posts
    5

    Unhappy Unanswered: Using ASP mail to send mails from MSSQL 2000 server

    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

  2. #2
    Join Date
    Aug 2002
    Location
    Scotland
    Posts
    1,578
    Ensure the login used to connect from ASP does have required permission to access or use XP_SERVICECONTROL and its an undocumented SP.

    What is the privlege of account used to start SQL Server services?
    --Satya SKJ
    Microsoft SQL Server MVP
    [IMG]http://sqlserver-qa.net/google_bart.gif[/IMG]

  3. #3
    Join Date
    Feb 2004
    Posts
    5
    Originally posted by Satya
    Ensure the login used to connect from ASP does have required permission to access or use XP_SERVICECONTROL and its an undocumented SP.

    What is the privlege of account used to start SQL Server services?
    The account used to connect from ASP already has DBO permissions. But it is still not working with those permissions. Thanks for looking into it.

  4. #4
    Join Date
    Aug 2002
    Location
    Scotland
    Posts
    1,578
    Its an undocumented system extended stored procedure named xp_servicecontrol, to start the SQL Server Agent service.

    And to start the service the login must have admin privileges on server and DBO permissions are not sufficient on server level.
    --Satya SKJ
    Microsoft SQL Server MVP
    [IMG]http://sqlserver-qa.net/google_bart.gif[/IMG]

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •