xp_cmdshell

  • How to send email using xp_cmdshell? Pls. advise.

    I need to create a batch file which can send email. Anyother way of doing this?

  • Have you considered xp_sendmail?  Have a look at Books On Line.

     

    Jez

  • xp_sendmail is the best way if you are looking for the server to send mail (all coming from one box).

    What are you trying to do?

  • xp_sendmail is great when using the default mail profile.

    I needed to use a different mail profile (prettied up for the users) so I ended up creating a DTS that was ran via a trigger on a table.  If you needed to run batch commands you could incorporate that into the DTS with a sendmail task in the flow.

    I suppose you could send mail via command line using SMTP commands, but then you are losing out on the Outlook / SQL integration which works pretty darn good.

  • Terrence,

    Outlook / SQL integration works well until a) the permissions for the account changes and SQL can no longer access the mailbox, b) Exchange admins reboot their server and SQL can no longer connect to Exchange requiring a restart of the service to re-establish the connection, c) to many other quirks to go on with here ...

    Much better to go with a solution like XPSMTP from http://www.sqldev.net this extended stored procedure works much the same as Database Mail in SQL Server 2005.

    --------------------
    Colt 45 - the original point and click interface

  • I just used a simple mail program called blat (doesn't require installation- its just an exe)

    then I use xp_cmdshell to run it.

  • I have set up a batch file call a .vbs script.  Check out this link to the Microsoft Technet Scripting Guys archives. 

    http://www.microsoft.com/technet/scriptcenter/resources/qanda/nov04/hey1129.mspx

Viewing 7 posts - 1 through 6 (of 6 total)

You must be logged in to reply to this topic. Login to reply