"Dejan Sarka" wrote:
> You might want to check the xp_smtp_sendmai from
>
http://sqldev.net/xp/xpsmtp.htm. >
> --
> Dejan Sarka, SQL Server MVP
> Associate Mentor
>
www.SolidQualityLearning.com >
> "Sri" <Sri@discussions.microsoft.com> wrote in message
> news:E7461F89-D839-4107-8FE7-C38B152DB7F4@microsoft.com...
> > I have written the following T-SQL code in a stored procedure to send
> email
> > using SMTP. The e-mail is going but the attachment is not going. If I try
> the
> > same in VB, the attachment is also going.
> >
> > SET @strAttach = 'd:\test.txt'
> >
> > 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, 'AttachFile', @strAttach
> > EXEC @hr = sp_OAMethod @MailID, 'Send', NULL
> > EXEC @hr = sp_OADestroy @MailID
> >
> > Please help me in this.
> >
> > Thanks in advance
>
>