Please start any new threads on our new site at We've got lots of great SQL Server experts to answer whatever question you can come up with.

Our new SQL Server Forums are live! Come on over! We've restricted the ability to create new threads on these forums.

SQL Server Forums
Profile | Active Topics | Members | Search | Forum FAQ
Save Password
Forgot your Password?

 All Forums
 Site Related Forums
 Article Discussion
 Problem in To address parameter in SP_SMTPMail
 Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Starting Member

1 Posts

Posted - 07/29/2005 :  06:23:28  Show Profile  Reply with Quote
Hi all ,
I have SP to send mails from sql server using the below code. Problem here is when the TO address parameter is accepting only 100 characters ,not more than that.
Please give me a solution to over come this problem .

Please mail to also.

Waiting for the solution

Thanks in Advance

Wide Regards always

Posted - 07/26/2001 : 19:42:27

FYI - Here's the modified script to get this to work with CDONTS (which is free).

Create Procedure sp_SMTPMail @SenderName varchar(100), @SenderAddress varchar(100), @RecipientName varchar(100), @RecipientAddress varchar(100), @Subject varchar(200), @Body varchar(8000)AS SET nocount on declare @oMail int --Object reference declare @resultcode int EXEC @resultcode = sp_OACreate 'CDONTS.NewMail', @oMail OUT if @resultcode = 0 BEGIN EXEC @resultcode = sp_OASetProperty @oMail, 'From', @SenderAddress EXEC @resultcode = sp_OASetProperty @oMail, 'To', @RecipientAddress EXEC @resultcode = sp_OASetProperty @oMail, 'Subject', @Subject EXEC @resultcode = sp_OASetProperty @oMail, 'Body', @Body EXEC @resultcode = sp_OAMethod @oMail, 'Send', NULL EXEC sp_OADestroy @oMail END SET nocount offGO

To test, call with something like:
exec sp_SMTPMail @SenderName='You', @SenderAddress='',@RecipientName = 'YouAgain', @RecipientAddress = '',@Subject='SQL Mail Test', @body='This is a test message from SQL Server. Smile! It worked.'

The only catch is getting CDONTS installed on your SQL Server without dumping excess junk there. I found one of our SQL Servers had IIS installed on it by mistake, and CDONTS came with it.

Should this (and Merkin's Original) go into the Script Library Forum?

Contractor$ never die, they just leave for higher-paying project$.

Edited by - AjarnMark on 07/26/2001 19:43:49

  Previous Topic Topic Next Topic  
 Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.02 seconds. Powered By: Snitz Forums 2000