Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
senthilsp
Starting Member
1 Post |
Posted - 2005-07-29 : 06:23:28
|
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 ssp1234@rediffmail.com also.Waiting for the solutionThanks in Advance Wide Regards alwaysSenPosted - 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 offGOTo test, call with something like:exec sp_SMTPMail @SenderName='You', @SenderAddress='YourName@YourMailSite.com',@RecipientName = 'YouAgain', @RecipientAddress = 'YourName@YourMailSite.com',@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 Senthil |
|
|
|
|
|
|