Follow Fantora on Twitter
Fantora Word of Classified Ads and Community Forum
Welcome Guest Search | Active Topics | Members | Log In | Register

email using MS Sql

Options
kirshana
Posted: Thursday, May 01, 2008 5:32:33 AM
Rank: Advanced Member
Groups: Member

Joined: 1/31/2008
Posts: 88
Points: 167
Location: India

email using MS Sql

Can you anyone help or point me out to the link that can help as to how to send emails by the stored procedures of MS SQL server?

Thanks in advance!
ca4nul
Posted: Wednesday, May 28, 2008 6:12:11 AM
Rank: Advanced Member
Groups: Member

Joined: 11/9/2007
Posts: 559
Points: 1,008
Location: GB

email using MS Sql

CREATE Procedure sn_SMTPMail
/*********************************************************************
** Simon / Lavanya
**
** PURPOSE:
** This stored procedure is used to send email from MS SQL Database
**
** TABLE USED:
** TEMP
** RESULT:
** Email Sent.
** Command:
** exec sn_SMTPMail
**********************************************************************/
AS
SET nocount on
declare @oMail int --Object reference
declare @resultcode int
EXEC @resultcode = sp_OACreate 'CDONTS.NewMail', @oMail OUT
if @resultcode = 0
BEGIN
DECLARE @t int
DECLARE cur CURSOR FOR Select id from temp where checkrecord = 'Y' and termdate > getdate() - 10
OPEN cur
FETCH NEXT FROM cur INTO @t
WHILE @@FETCH_STATUS = 0 BEGIN
EXEC @resultcode = sp_OASetProperty @oMail, 'From', 'lavanyasimon@yahoo.com'
EXEC @resultcode = sp_OASetProperty @oMail, 'To', 'simonnadar@yahoo.com'
EXEC @resultcode = sp_OASetProperty @oMail, 'Subject', @t
EXEC @resultcode = sp_OASetProperty @oMail, 'Body', 'ID Expires in next 10 days. Please Take Appropriate Action'
EXEC @resultcode = sp_OAMethod @oMail, 'Send', NULL
EXEC sp_OADestroy @oMail
FETCH NEXT FROM cur INTO @t
END
CLOSE cur
DEALLOCATE cur
END
SET nocount off
GO
Users browsing this topic
Guest

 Related
Index on a table
Business development
TV: Navy NCIS episode.
Integration Solutions Possible without writing Codes
Innovative Enterprise Application Integration
Upcoming Webinar: Reduce IT infrastructure costs using Application Portfolio Management
Highly configurable and extensible Dataflow architecture
Upcoming Webinar: Best Practices and Proven Techniques for Application Portfolio Management
Recorded Webinar: Data Management Challenges for Govt Applications
Elegant dataflow solution
Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

Fantora Blog | Discount Shop UK | Discount Shop USA | Discount Shop Canada | Discount Boutique France | Discount Shop Deutschland | Discount Shop Italia | Descuento Shop España

Free Classified ads, Webmaster Forum & Technology Reviews | Fantora Free Classified Ads | Buy & Sell Electronics, Mobile phones & Accessories | fantora Forums Community | Buy & Sell DVD, Games and Consols | Free eBooks & Softwares | SEO & Affiliate Marketing Discussion | Programming Language Forum (.NET, ASP, PHP, SQL) | Free Classified Ads | General Stuff (Movies, Chat, Comics) | Free Online English Movies & Reviews | Free Online Hindi Movies & Reviews | Australia & New Zealand Immigration Forum | Europe immigration forum | Canada Immigration Forum | Ireland Immigration Forum | US Immigration Forum | United Kingdom Immigration Forum

Main Forum RSS : RSS

Powered by: YAF.NET
Copyright © AI Logica All rights reserved.
This page was generated in 0.906 seconds.