you can send mail in sql server.

Deepak Ghule replied to simi d at 03-Jul-08 09:19

when we send mail from asp.net application,
if the no of recipent are large then it will give error like timeout.

you can send mail in sql server.


CREATE PROCEDURE [dbo].[sp_SendEmail]  @ServerAddr varchar(80),
@FromAddr varchar(80),
@Recipient varchar(80),
@Subject varchar(132),
@BodyText varchar(2000),
@nRet int OUTPUT

AS
DECLARE @hr int
DECLARE @oSmtp int
 
EXEC @hr = sp_OACreate 'AOSMTP.Mail',@oSmtp OUT
EXEC @hr = sp_OASetProperty @oSmtp, 'RegisterKey', 'replace this text by your key'
EXEC @hr = sp_OASetProperty @oSmtp, 'ServerAddr', @ServerAddr
EXEC @hr = sp_OASetProperty @oSmtp, 'FromAddr', @FromAddr
EXEC @hr = sp_OAMethod @oSmtp, 'AddRecipient', NULL, @Recipient, @Recipient, 0
EXEC @hr = sp_OASetProperty @oSmtp, 'Subject', @Subject
EXEC @hr = sp_OASetProperty @oSmtp, 'BodyText', @BodyText
 
EXEC @hr = sp_OAMethod @oSmtp, 'SendMail', @nRet OUT
EXEC @hr = sp_OADestroy @oSmtp

 

refer these links
http://www.emailarchitect.net/WebApp/SMTPCOM/developers/sqlemail.asp
http://www.databasejournal.com/features/mssql/article.php/3489111


Click here to sign in and reply. You could earn money via our $500 contest just for being helpful.
  sending emails asynchronously. - simi d  03-Jul-08 09:10 9:10:08 AM
      you can send mail in sql server. - Deepak Ghule  03-Jul-08 09:19 9:19:15 AM
          sending mails in asp.net application - simi d  07-Jul-08 02:24 2:24:08 AM
          sending mails in asp.net application - simi d  07-Jul-08 03:04 3:04:00 AM
      asynchronous email - Umapathy Kaliaperumal  03-Jul-08 09:30 9:30:20 AM
          sending mails in asp.net application. - simi d  07-Jul-08 02:25 2:25:44 AM
      See this for sending mails - Sujit Patil  03-Jul-08 11:58 11:58:38 PM
          sending mails in asp.net application. - simi d  07-Jul-08 02:28 2:28:05 AM
      Send Email Async... - santhosh kumar  04-Jul-08 02:12 2:12:26 AM
          sending mails in asp.net application. - simi d  07-Jul-08 02:30 2:30:15 AM
View Posts