For Programmers: Free Programming Magazines  


Home > Archive > ASP > August 2005 > Solution needed









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Solution needed
Slim

2005-08-21, 7:55 am

I am building a web site where people can register for a newsletter. when
they register they enter a email address into the database so we can send
the news letter to them.
Now what I want to do is for the owner of the site to be able to email a
HTML email to the server (win 2000 with exchange) and then forward the email
to all addresses in the database.

Can I get hold of the email though a data connection? Or can I add the
addresses to a group and then send from exchange?

any ideas?


Bullschmidt

2005-08-21, 9:55 pm

I'd suggest having a table with a field to store the body of the e-mail
and perhaps the date and perhaps an IsSent field or something.

And create a Web page for the owner of the site to enter the relevant
data for the e-mail and perhaps have a page to be able to view the
e-mail in HTML format and then of course have a Send button...

How do I send e-mail with CDO?
http://www.aspfaq.com/show.asp?id=2026

VBScript To Send Email Using CDO
[url]http://www.paulowski.com/WSH/cdo.htm[/url]

How do I send e-mail from ASP?
http://www.aspfaq.com/show.asp?id=2119

Best regards,
J. Paul Schmidt, Freelance ASP Web Developer
http://www.Bullschmidt.com
ASP Design Tips, ASP Web Database Demo, Free ASP Bar Chart Tool...

<<
I am building a web site where people can register for a newsletter.
when
they register they enter a email address into the database so we can
send
the news letter to them.
Now what I want to do is for the owner of the site to be able to email a
HTML email to the server (win 2000 with exchange) and then forward the
email
to all addresses in the database.

Can I get hold of the email though a data connection? Or can I add the
addresses to a group and then send from exchange?[color=darkred]


*** Sent via Developersdex http://www.developersdex.com ***
Slim

2005-08-22, 7:55 am

i think you miss my pint,

the author of the newsletter, wants to compil the newsletter in word from a
remote location and email it to the others, so how do i get that email to go
to all on the database list

thanks


"Bullschmidt" <paul@bullschmidt.com-nospam> wrote in message
news:ut6WfYrpFHA.2152@TK2MSFTNGP14.phx.gbl...
> I'd suggest having a table with a field to store the body of the e-mail
> and perhaps the date and perhaps an IsSent field or something.
>
> And create a Web page for the owner of the site to enter the relevant
> data for the e-mail and perhaps have a page to be able to view the
> e-mail in HTML format and then of course have a Send button...
>
> How do I send e-mail with CDO?
> http://www.aspfaq.com/show.asp?id=2026
>
> VBScript To Send Email Using CDO
> [url]http://www.paulowski.com/WSH/cdo.htm[/url]
>
> How do I send e-mail from ASP?
> http://www.aspfaq.com/show.asp?id=2119
>
> Best regards,
> J. Paul Schmidt, Freelance ASP Web Developer
> http://www.Bullschmidt.com
> ASP Design Tips, ASP Web Database Demo, Free ASP Bar Chart Tool...
>
> <<
> I am building a web site where people can register for a newsletter.
> when
> they register they enter a email address into the database so we can
> send
> the news letter to them.
> Now what I want to do is for the owner of the site to be able to email a
> HTML email to the server (win 2000 with exchange) and then forward the
> email
> to all addresses in the database.
>
> Can I get hold of the email though a data connection? Or can I add the
> addresses to a group and then send from exchange?
>
>
> *** Sent via Developersdex http://www.developersdex.com ***



Bullschmidt

2005-08-22, 7:55 am

Here's a snippet of code I've used for putting users' e-mail addresses
into a comma separated string.

' *** Build strUserEmails - E-mail addresses separated by comma and
space.
' Set sql.
strSQL = "SELECT UserEmail "
strSQL = strSQL & "FROM tblUser "
strSQL = strSQL & "WHERE (1=1) "
strSQL = strSQL & " AND ( "
' EquipUser level user shown in EquipEvent.EquipEventUserID if there
is one.
If EquipEventUserID <> "" Then
strSQL = strSQL & "( "
strSQL = strSQL & "(UserLevel=" & Chr(39) & "EquipUser" & Chr(39) &
") "
strSQL = strSQL & " AND (UserID=" & Chr(39) &
jpsvbFixSQL(EquipEventUserID) & Chr(39) & ") "
strSQL = strSQL & ") "
End If
' EquipAdmin level users.
strSQL = strSQL & " OR (UserLevel=" & Chr(39) & "EquipAdmin" &
Chr(39) & ") "
' Admin level users.
strSQL = strSQL & " OR (UserLevel=" & Chr(39) & "Admin" & Chr(39) &
") "
strSQL = strSQL & ") "
strSQL = strSQL & " AND (UserEmail Is Not Null) "
strSQL = strSQL & " AND (UserIsEmailNotif=True) "
strSQL = strSQL & "ORDER BY UserLName, UserFName "

' Open rs.
Set objRS = Server.CreateObject("ADODB.Recordset")
objRS.Open strSQL, objConn

' If no recs.
If objRS.EOF Then
' Close rs.
objRS.Close
Set objRS = Nothing

Exit Function
Else
' Put recs into array for speed.
arrayRS = objRS.GetRows

' Close rs.
objRS.Close
Set objRS = Nothing

' Init.
strUserEmails = ""

' Loop thru rows (i.e. recs).
For I = 0 To UBound(arrayRS, 2)
' Set var using each fld's col num.
UserEmail = jpsvbNullToBlank(arrayRS(0, I))
strUserEmails = strUserEmails & ", " & UserEmail
Next

' Remove initial comma and space.
strUserEmails = Right(strUserEmails, Len(strUserEmails) - 2)
End If

And here's a good reference for sending an e-mail attachment such as a
Word doc (although of course some users' computers might not allow a
Word doc to come through without special consideration since it could
contain macros:

Email (with Attachment)
http://www.asp101.com/samples/email_attach.asp

Best regards,
J. Paul Schmidt, Freelance ASP Web Developer
http://www.Bullschmidt.com
ASP Design Tips, ASP Web Database Demo, Free ASP Bar Chart Tool...

<<
the author of the newsletter, wants to compil the newsletter in word
from a
remote location and email it to the others, so how do i get that email
to go
to all on the database list[color=darkred]



*** Sent via Developersdex http://www.developersdex.com ***
Slim

2005-08-23, 7:55 am

You are still missing my point

I can handle the seding of emails,

What im am having a problem with is the trigger, the author of the newsleter
emailes his email to a exhcnage server, how do i then get that email to all
on the list? seeing that the list is not in exchange but in a SQL database?


"Bullschmidt" <paul@bullschmidt.com-nospam> wrote in message
news:uugBsRxpFHA.2900@TK2MSFTNGP10.phx.gbl...
> Here's a snippet of code I've used for putting users' e-mail addresses
> into a comma separated string.
>
> ' *** Build strUserEmails - E-mail addresses separated by comma and
> space.
> ' Set sql.
> strSQL = "SELECT UserEmail "
> strSQL = strSQL & "FROM tblUser "
> strSQL = strSQL & "WHERE (1=1) "
> strSQL = strSQL & " AND ( "
> ' EquipUser level user shown in EquipEvent.EquipEventUserID if there
> is one.
> If EquipEventUserID <> "" Then
> strSQL = strSQL & "( "
> strSQL = strSQL & "(UserLevel=" & Chr(39) & "EquipUser" & Chr(39) &
> ") "
> strSQL = strSQL & " AND (UserID=" & Chr(39) &
> jpsvbFixSQL(EquipEventUserID) & Chr(39) & ") "
> strSQL = strSQL & ") "
> End If
> ' EquipAdmin level users.
> strSQL = strSQL & " OR (UserLevel=" & Chr(39) & "EquipAdmin" &
> Chr(39) & ") "
> ' Admin level users.
> strSQL = strSQL & " OR (UserLevel=" & Chr(39) & "Admin" & Chr(39) &
> ") "
> strSQL = strSQL & ") "
> strSQL = strSQL & " AND (UserEmail Is Not Null) "
> strSQL = strSQL & " AND (UserIsEmailNotif=True) "
> strSQL = strSQL & "ORDER BY UserLName, UserFName "
>
> ' Open rs.
> Set objRS = Server.CreateObject("ADODB.Recordset")
> objRS.Open strSQL, objConn
>
> ' If no recs.
> If objRS.EOF Then
> ' Close rs.
> objRS.Close
> Set objRS = Nothing
>
> Exit Function
> Else
> ' Put recs into array for speed.
> arrayRS = objRS.GetRows
>
> ' Close rs.
> objRS.Close
> Set objRS = Nothing
>
> ' Init.
> strUserEmails = ""
>
> ' Loop thru rows (i.e. recs).
> For I = 0 To UBound(arrayRS, 2)
> ' Set var using each fld's col num.
> UserEmail = jpsvbNullToBlank(arrayRS(0, I))
> strUserEmails = strUserEmails & ", " & UserEmail
> Next
>
> ' Remove initial comma and space.
> strUserEmails = Right(strUserEmails, Len(strUserEmails) - 2)
> End If
>
> And here's a good reference for sending an e-mail attachment such as a
> Word doc (although of course some users' computers might not allow a
> Word doc to come through without special consideration since it could
> contain macros:
>
> Email (with Attachment)
> http://www.asp101.com/samples/email_attach.asp
>
> Best regards,
> J. Paul Schmidt, Freelance ASP Web Developer
> http://www.Bullschmidt.com
> ASP Design Tips, ASP Web Database Demo, Free ASP Bar Chart Tool...
>
> <<
> the author of the newsletter, wants to compil the newsletter in word
> from a
> remote location and email it to the others, so how do i get that email
> to go
> to all on the database list
>
>
>
> *** Sent via Developersdex http://www.developersdex.com ***



Jeff Cochran

2005-08-25, 3:55 am

On Sun, 21 Aug 2005 20:38:46 +0800, "Slim" <me@here.com> wrote:

>I am building a web site where people can register for a newsletter. when
>they register they enter a email address into the database so we can send
>the news letter to them.
>Now what I want to do is for the owner of the site to be able to email a
>HTML email to the server (win 2000 with exchange) and then forward the email
>to all addresses in the database.
>
>Can I get hold of the email though a data connection? Or can I add the
>addresses to a group and then send from exchange?
>
>any ideas?


Look at any mailing list software.

Jeff
Chris Hohmann

2005-08-25, 6:55 pm

"Slim" <me@here.com> wrote in message
news:OGdwi0kpFHA.2152@TK2MSFTNGP14.phx.gbl...
>I am building a web site where people can register for a newsletter. when
> they register they enter a email address into the database so we can send
> the news letter to them.
> Now what I want to do is for the owner of the site to be able to email a
> HTML email to the server (win 2000 with exchange) and then forward the
> email
> to all addresses in the database.
>
> Can I get hold of the email though a data connection? Or can I add the
> addresses to a group and then send from exchange?
>
> any ideas?
>
>


1. You could access the message store via the IMessages interface in CDOEX,
find the message in question, retrieve the body of the message and then use
CDO to construct a new mail message using the retrieved body and a recipient
list generated from the address stored in your database.

Here's the link to the IMessages interface in CDOEX:
http://msdn.microsoft.com/library/e...s_interface.asp

Here's the link to the CDO documentation:
http://msdn.microsoft.com/library/e...2775976c12f.asp

2. You could use the OLE-DB Provider for Exchange to treat the message store
as a data source, then similar to option 1 you could retrieve the message
body and use CDO to construct a new message using the retrieved body and a
recipient list constructed from the addresses stored in your database.
Here's a link to an example of a connection string using the provider for
Exchange:

http://www.carlprothman.net/Default...iderForExchange

3. Create a filter on the exchange account that receives the administrators
email and use the "start application" action to pass the message body to a
custom windows shell script that does the same thing as options 1 and 2,
namely use CDO to construct a new mail message using the passed in body and
a recipient list generated from the address stored in your database. Here's
a link to the Windows Scripting Host documentation:
http://msdn.microsoft.com/library/e...sScriptHost.asp

HTH
-Chris Hohmann


Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com