473,395 Members | 1,972 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Sending external email from within a Scheduled Job

I'm not a newbie, but I've not been able to find out how to do this
particular task, and BOL isn't being too cooperative.

My application sits on a SQL Server backend (SQL Server 2000).

The application is a Document Distribution system. Some subscribers
have elected to be notified by e-mail that a new revision of a document
is available.

I want to run a daily job that would search for new revisions and email
any electronic subscribers. Pseudo code example:

DECLARE MailList CURSOR FOR

SELECT
EMailAddress
FROM
Customers
INNER JOIN DocumentDistribution ON
Customers.CustomerID = DocumentDistribution.CustomerID
WHERE
DocumentDistribution.DocumentID = @DocumentID AND
Customers.EMailEnabled = 1

OPEN MailList

FETCH NEXT FROM MailList
WHILE @@FETCH_STATUS = 0
BEGIN
/* Format and send the email to the customer here */
FETCH NEXT FROM MailList
END

CLOSE MailList
DEALLOCATE MailList

What do I need to do on the server to make this work?

Many thanks in advance

Edward
--
The reading group's reading group:
http://www.bookgroup.org.uk

Jul 23 '05 #1
1 2247

<te********@hotmail.com> wrote in message
news:11*********************@f14g2000cwb.googlegro ups.com...
I'm not a newbie, but I've not been able to find out how to do this
particular task, and BOL isn't being too cooperative.

My application sits on a SQL Server backend (SQL Server 2000).

The application is a Document Distribution system. Some subscribers
have elected to be notified by e-mail that a new revision of a document
is available.

I want to run a daily job that would search for new revisions and email
any electronic subscribers. Pseudo code example:

DECLARE MailList CURSOR FOR

SELECT
EMailAddress
FROM
Customers
INNER JOIN DocumentDistribution ON
Customers.CustomerID = DocumentDistribution.CustomerID
WHERE
DocumentDistribution.DocumentID = @DocumentID AND
Customers.EMailEnabled = 1

OPEN MailList

FETCH NEXT FROM MailList
WHILE @@FETCH_STATUS = 0
BEGIN
/* Format and send the email to the customer here */
FETCH NEXT FROM MailList
END

CLOSE MailList
DEALLOCATE MailList

What do I need to do on the server to make this work?

Many thanks in advance

Edward
--
The reading group's reading group:
http://www.bookgroup.org.uk


There are several options, including SQL Mail, xp_smtp_sendmail, or an
external script. SQL Mail is the "standard" way to send email from MSSQL,
using the xp_sendmail procedure - see Books Online for more details, and
this article:

http://support.microsoft.com/kb/263556/EN-US/

However, SQL Mail has some issues - you need to install a MAPI client (eg
Outlook) on the server, which many DBAs are unwilling to do; it works best
with Exchange and can be awkward with SMTP; it doesn't support HTML mail
etc. As a result, xp_smtp_sendmail is a popular replacement, because it's a
single DLL and therefore less 'intrusive':

http://www.sqldev.net/xp/xpsmtp.htm

Or simply write your own mailing script in a language like C#, Perl etc.,
and launch it from a scheduled task in MSSQL. If you need to compose HTML or
do other text formatting, that may be a better option than doing everything
in SQL anyway.

Simon
Jul 23 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Owen | last post by:
I am sending email using CDO but it only seems to work when the "To" address is within the same domain as mine. When I send to an outside domain (eg. yahoo.com) the mail simply does not reach...
1
by: Targa | last post by:
I have an ASP scheduling application in which there are blocks of time, represented with a table, within another table which is the timeline. In other words, I have a table with a vertical...
2
by: Elliot | last post by:
The following code works when sending to an email address that resides on our Exchange domain. However, when trying to send to an External domain it does not work. The folling is the "doesn't work"...
5
by: BaWork | last post by:
I have a web form where a client can select which site members to send an email to. This form is populated from the contents of the member table, so the form can have 0-x names listed on it...
1
by: Martin_Hurst | last post by:
Is it possible to establish a connection from within a postgres database to another external database on the network, i.e., not a java or scripting connection, BUT by some type of table definition...
6
by: Robert Pettersson | last post by:
Hi, I have built an webapp in C# that uses SMTPMail to send mail to users. When I installed it on the prodserver everything worked fine for me, but the users can not send mail. They get Access...
8
by: Frank | last post by:
I think I've confused myself completely here :-) I have used System.Web.Mail, but am not sure if this works with Exchange Server 5.5. I asked the client if they're email server supported SMTP, and...
1
by: Eric Sheu | last post by:
Greetings, I have been searching the web like mad for a solution to my SMTP problem. I am using Windows Server 2003 and ASP.NET 2.0 w/ C# to send out e-mails from a web site I have created to...
14
by: sridhar | last post by:
iam having user account on an exchangeserver. with that can i send an email using python? if iam using the following code iam getting error fromAddress = 'sridhar_kasturi@satyam.com'...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.