SQL Server Performance

XPSMTP troubles

Discussion in 'General Developer Questions' started by evaleah, Jun 2, 2005.

  1. evaleah New Member

    I am using XPSMTP available fromhttp://www.sqldev.net/xp.htm. It appears to be working fine but I keep getting Error: connecting to server servername. I am able to ping servername from the SQL Server. I have configured Outlook Express to send email using servername and it works. The connection only seems to fail when using th xp. Anyone have any ideas what to look for?

  2. Madhivanan Moderator

    The link you have given is not working
    See if this helps you

    @From varchar(255),
    @To varchar(255),
    @Message varchar(8000),
    @Subject varchar(255))

    DECLARE @CDO int, @OLEResult int, @Out int

    --Create CDONTS.NewMail object
    EXECUTE @OLEResult = sp_OACreate 'CDONTS.NewMail', @CDO OUT
    IF @OLEResult <> 0 PRINT 'CDONTS.NewMail'

    EXECUTE @OLEResult = sp_OASetProperty @CDO, 'BodyFormat', 0
    EXECUTE @OLEResult = sp_OASetProperty @CDO, 'MailFormat', 0

    --Call Send method of the object
    execute @OLEResult = sp_OAMethod @CDO, 'Send', Null, @From, @To, @Subject, @Message, 1 --0 is low 1 is normal
    IF @OLEResult <> 0 PRINT 'Send'

    --Destroy CDO
    EXECUTE @OLEResult = sp_OADestroy @CDO

    return @OLEResult


    Failing to plan is Planning to fail
  3. benwilson New Member

    Hi Eva,
    When you say you are able to ping from SQL Server, does this mean that the following code returns 0? It could be that the XP isnt installed properly?!?

  4. satya Moderator

Share This Page