473,403 Members | 2,293 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,403 software developers and data experts.

Batch E-mail

Hello,

I have a content site. On this site a user can select a peice of content then have it e-mailed to there e-mail address. Then they continue the process for each item they wish to have e-maile dto them.

My question is. If i want them to be able to batch select the items they want to recieve instead of 1 at a time, would I have to go about this with a shopping cart routine? or is there a simpler way that I am just over looking?

Thanks in advance,

G
Feb 11 '08 #1
7 1437
DrBunchman
979 Expert 512MB
Hi there,

I'd suggest storing the list of items in an array. Once they have finished selecting items the entire contents of the array could then be e-mailed.

Does this help?

Dr B
Feb 11 '08 #2
markrawlingson
346 Expert 100+
No it wouldn't have to be a shopping cart, though it may look like some shopping carts, asthetically speaking.

There are many solutions for any problem, and since I don't know a whole lot about how you've set this up, i'll give you one suggestion.

Providing that you have your descriptions set up in a row based table in your database, I would have a checkbox system with a form post. Allow the user to check of each item they would like info regarding, and then provide a button at the bottom "Email me the info!"

1. Create your checkboxes with a unique identifier attached to them.

Expand|Select|Wrap|Line Numbers
  1. <input type="checkbox" name="bSelected<% =oRs("ID") %>" value="true" />
  2.  
Where oRs("ID") = the auto-increment field in your database table for the description of the item.

2. After the form has posted.. parse the information you recieve. Pass each of the IDs into your recordset to pull the information for each of the Items, loop through the recordset and create an email body of the information in which to send the user, pertinent to their choices.

Expand|Select|Wrap|Line Numbers
  1. For Each oItem In Request.Form
  2.    If InStr(oItem,"bSelected") > 0 And CBool( Request.Form( oItem ) ) = True Then
  3.       sTemp = sTemp & Replace( Request.Form( oItem ), "bSelected", "") & " "
  4.    End If
  5. Next
  6. 'sTemp will now be a string of all the IDs of the user's selection separated by a space so we can parse them into an array easily.
  7. aTemp = Split( sTemp )
  8. sSQL = "SELECT * FROM [tblDescriptions]"
  9. If IsArray( aTemp ) Then
  10.    For i = 0 To UBound( aTemp )
  11.       If i = 0 Then
  12.          sSQL = sSQL & " WHERE ID = " & CInt( aTemp( i ) )
  13.       Else
  14.          sSQL = sSQL & " OR ID = " & CInt( aTemp( i ) )
  15.       End If
  16.    Next
  17. ElseIf aTemp <> Empty Then
  18.    sSQL = sSQL & " WHERE ID = " & CInt( aTemp( i ) )
  19. End If
  20. Set oRs = Server.CreateObject("ADODB.RecordSet")
  21. oRs.Open sSQL, Your_Connection, adOpenStatic, adLockOptimistic, adCmdText
  22. Do Until oRs.EOF = True
  23.    sMessage = sMessage & oRs("sTitleOfItem") & VbCRLF
  24.    sMessage = sMessage & "The Item information goes here..."
  25.    oRs.MoveNext
  26. Loop
  27. oRs.Close
  28. Set oRs = Nothing
  29.  
3. Create your mailer object, set the subject, from address, to address, set the message into the body, and send the email.

Hope this gives you some insight.

Sincerely,
Mark
Feb 11 '08 #3
Thanks for the insight Mark,

My site is comprised entirely of XSL/XML .ASP. no SQL.

G.
Feb 11 '08 #4
markrawlingson
346 Expert 100+
No problem.

The same could be adapted to parse an XML document and send the info from it. And for that matter, .csv or even .txt or .xls files could be used to hold the information and parsed to send the required info... Or you could even just hold all the descriptive information within the .asp file and parse through a bunch of variables which hold that information - wouldn't recommend that, but it's possible. Probably the easiest way would be to create an access database to work off of, but if you'd prefer xml or some other method that's fine too.

Like I said, lots of ways to do it. If you want coding examples for any of the options above i'd be happy to oblige.

Sincerely,
Mark
Feb 11 '08 #5
Examples would be much apreciated. Using XML XSL ASP

G.
Feb 11 '08 #6
markrawlingson
346 Expert 100+
I'm sure I don't have to explain how to write an XML document, but just for the sake of sakes (and other viewer's information/education)..

1) the .xml document
Expand|Select|Wrap|Line Numbers
  1. <document>
  2.    <message>some message</message>
  3.    <message>some message</message>
  4.    <message>some message</message>
  5. </document>
  6.  
2) The page to display the selections to the user

Expand|Select|Wrap|Line Numbers
  1. <%
  2.    Set oXML = Server.CreateObject("msxml2.DOMDocument") 
  3.    oXML.async = true 
  4.    oXML.Load(Server.MapPath("/path/to/doc.xml"))
  5.    Set oMessages = oXML.DocumentElement.GetElementsByTagName("message")
  6.    For i = 0 To oMessages.Length - 1
  7. %>
  8.    <input type="checkbox" name="bSelected<% =i %>" value="true" />
  9.    <!-- do whatever else you need to do, maybe some descriptive message, or wrap this inside table tags, etc.
  10. <%
  11.    Next
  12. %>
  13.  
3) Parse the information, retrieving the message node information according to what the user chose

Expand|Select|Wrap|Line Numbers
  1. For Each oItem In Request.Form
  2.    If InStr(oItem,"bSelected") > 0 And CBool( Request.Form( oItem ) ) = True Then
  3.       sTemp = sTemp & Replace( Request.Form( oItem ), "bSelected", "") & " "
  4.    End If
  5. Next
  6. 'sTemp will now be a string of all the IDs of the user's selection separated by a space so we can parse them into an array easily.
  7. aTemp = Split( sTemp )
  8. 'open the XML document and retrieve our list of message nodes
  9. Set oXML = Server.CreateObject("msxml2.DOMDocument") 
  10. oXML.async = true 
  11. oXML.Load(Server.MapPath("/platform/platform.xml"))
  12. Set oMessages = oXML.DocumentElement.GetElementsByTagName("message")
  13. 'Loop through the aTemp array, grabbing the information from the node as per the selections from the user which are numerical values held within the array. The numerical numbers represent the index of the message node within the xml document.
  14. If IsArray( aTemp ) Then
  15.    For i = 0 To UBound( aTemp )
  16.       sEmailBody = sEmailBody & oMessages.Item( aTemp( i ) ).Text & VbCRLF
  17.    Next
  18. ElseIf aTemp <> Empty Then
  19.    sEmailBody = oMessages.Item( aTemp( i ) ).Text
  20. End If
  21. Set oXML = Nothing
  22.  
Hope that helps guide you in the right direction.

Sincerely,
Mark
Feb 11 '08 #7
Hi Mark,

Thanks for the example, I'll test a few ideas using your meothods today. The xml doc example wasn't required but I'm sure someone will find it useful. :)

Thanks again,

G.
Feb 12 '08 #8

Sign in to post your reply or Sign up for a free account.

Similar topics

12
by: Moosebumps | last post by:
So, after reading some messages about os.system, and looking at the popen stuff and trying it a bit, I still have not found a way to keep a command window open for several commands (on Windows...
4
by: Bill | last post by:
I need help closing a CMD window when it is executed from Access. 1) The batch file is called from Access. 2) Access closes, 3) the batch runs a copy of the access database (creating a backup)...
6
by: Charles Neitzel | last post by:
I'm trying to write a windows application in C# (Using Microsoft Visual C# 2005 Express) that is nothing more than a simple UI with buttons on it. The buttons do various things like running...
1
by: Charles | last post by:
I'm trying to write a windows application in C# (Using Microsoft Visual C# 2005 Express) that is nothing more than a simple UI with buttons on it. The buttons do various things like running...
2
by: Blippy | last post by:
I want to create a small look up program that searches for a certain date and the batch number that is represented by that day. For instance if i wanted to find the batch for 20/08/05 i would...
3
by: emman_54 | last post by:
Hi every one, I am trying to run a batch file using my asp.net application. I am using the Process class to run the batch file. When I run my web application, In the task manager, i could see...
1
by: Crash | last post by:
Hi, ..NET v1.x SP1 VS 2003 SQL Server 2000 SP3 Server 2000, XP, Server 2003 I would like to programmatically execute {possibly many} SQL Server batch scripts. Aka I have many scripts that...
12
by: tojigneshshah | last post by:
Hi, I have a situation where i have multiple batch and the each batch are sequence numbers. For each batch, the number should start with 1. For example: Col.no1 Col.no2 ------ ...
4
ck9663
by: ck9663 | last post by:
hi guys this is a little challenging, at least for me...here goes... i have to run a DOS batch file from a server. with some parameters that i need to pass. these parameters can be found on a...
14
by: =?Utf-8?B?R2lkaQ==?= | last post by:
Hi, In my windows applicationm, i need to excute a batch file. this batch file throws some text and questions to the screen, i need to catch the standard Output, check if it's a question, in...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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
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
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.