Send mail without MAPI

  • Hello,

    I am using SQL Server 2000 on Windows Server 2003 and I want to send mails somehow without using (and installing) Microsoft Outlook.

    I have created the following procedure, but it does not work:

    CREATE PROCEDURE [dbo].[sp_send_cdontsmail]

    @From varchar(100),

    @To varchar(100),

    @Subject varchar(100),

    @Body varchar(4000),

    @cc varchar(100) = null,

    @BCC varchar(100) = null

    AS

    Declare @MailID int

    Declare @hr int

    EXEC @hr = sp_OACreate 'CDONTS.NewMail', @MailID OUT

    EXEC @hr = sp_OASetProperty @MailID, 'From',@From

    EXEC @hr = sp_OASetProperty @MailID, 'Body', @Body

    EXEC @hr = sp_OASetProperty @MailID, 'BCC',@BCC

    EXEC @hr = sp_OASetProperty @MailID, 'CC', @cc

    EXEC @hr = sp_OASetProperty @MailID, 'Subject', @Subject

    EXEC @hr = sp_OASetProperty @MailID, 'To', @To

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

    EXEC @hr = sp_OADestroy @MailID

     

    what can I do to make it work, or find another solution for mailing?

  • Hello,

    Search the forums for 'smtp' and you will get different threads.

    Thanks and have a great day!!!


    Lucky

  • Have a look on this : http://www.sqldev.net/xp/xpsmtp.htm

    I'm using a lot and it works fine for me.



    Bye
    Gabor

  • Hello,

    Have a look on this :

    http://www.sqlteam.com/filtertopics.asp?topicID=125

    This will help you.

    Kenavo

    Philippe

  • Another method is to create an instance of SQL Server 2000 on your client machine and send mail from your own email software. Create the stored procedures and tables to gather the info you want then access the data through your local instance linked to the production server.

  • I have found a solution, explained at:

    http://support.microsoft.com/default.aspx?scid=kb;en-us;312839&sd=tech

    the stored procedure listed in my previous post does not work, because I am using Windows server 2003. Now I am using cdosys insted of cdonts, and everything works fine.

    Thanks for the ideas,

    Alex

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

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