Let me first off apologize for the delay in my response.....I'm "the
go-to guy" which means that I am ALWAYS busy with something....This is
the first time I've been able to sit down again with this and take a
gander....
Here's the rundown again;
I have actually made an Access db and I have put in fields that
contain the email address and then also something like a grid with
yes/no entries so I can run a SQL statement (SELECT * FROM verify
WHERE conversions is yes....example) but the problem I''ll still have
is that Persits (the email component) only allows for one address per
"Mail.AddAddress" line and one per Mail.AddCC...Grrr....So I can't
make a large mailing list (which is actually what I need to do...all
people fitting a particular category should get emailed...)
Please take a look and possibly jump-start my brain into heading the
right direction.....Here's the code again.....It's pretty rough, I'd
been trying to think of how to go about making up these mailing
lists...By the way, the db that contains the emails is
"/jax/wh/Online_Forms/Secured_Archives/wh.mdb"
<code>
<!-- #INCLUDE VIRTUAL="/_borders/top_nav.asp" -->
<%
Mode = request("mode")
Carton = request.form("carton")
Comments = request.form("comments")
Name = request.form("name")
Reason = request("reason")
Shift = request.form("shift")
Alice** = "a*@***.com"
Mary*** = "m*@***.com"
Tracy*** = "t*@***.com"
Rodney*** = "r*@***.com"
Reginald*** = "r*@***.com"
John*** = "j*@***.com"
Toby*** = "t*@***.com"
Shannon*** = "s*@***.com"
Robin*** = "r*@***.com"
Ken*** = "k*@***.com"
Kim*** = "k*@***.com"
Terry*** = "t*@**.com"
Don*** = "d*@**.com"
DaveTest1 = "dmiller@**.com"
DaveTest2 = "dm**********@gmail.com"
'************************************************* ****************************
'* FORM FOR DATA INPUT
*
'************************************************* ****************************
Sub Form()
Response.Write "<form method='POST' action='verification.asp'
name='verify' onSubmit='validate()'>"
Response.Write " <div align='left'>"
Response.Write "<table border='0' cellpadding='0' width='976'>"
Response.Write "<tr>"
Response.Write "<td width='141'>Name :</td>"
Response.Write "<td width='784'><input type='text' name='name'
size='20'></td>"
Response.Write "</tr>"
Response.Write "<tr>"
Response.Write "<td width='141'>Day / Night Shift</td>"
Response.Write "<td width='357'><input type='radio' name='shift'
value='Day'>Day Shift"
Response.Write "<input type='radio' name='shift' value='Night'>Night
Shift</td>"
Response.Write "</tr>"
Response.Write "<tr>"
Response.Write "<td width='141'>Carton Number:</td>"
Response.Write "<td width='784'><input type='text' name='carton'
size='20'></td>"
Response.Write "</tr>"
Response.Write "<tr>"
Response.Write "<td width='141'>Reason:</td>"
Response.Write "<td width='784'>"
Response.Write "<select size='1' name='reason' tabindex='8'>"
Response.Write "<option value='Putaway'>CASE PUTAWAY</option>"
Response.Write "<option value='Conversions'>CONVERSIONS</option>"
Response.Write "<option value='Drivers'>DRIVER TEAM</option>"
Response.Write "<option value='Inspections'>INSPECTIONS</option>"
Response.Write "<option value='Invoiced'>INVOICED</option>"
Response.Write "<option value='Label'>LABEL REPLACES</option>"
Response.Write "<option value='Loaded'>LOADED</option>"
Response.Write "<option value='Located'>LOCATED STATUS</option>"
Response.Write "<option value='Manifested'>MANIFESTED</option>"
Response.Write "<option value='Other'>OTHER</option>"
Response.Write "<option value='Packed'>PACKED STATUS</option>"
Response.Write "<option value='Pending'>PENDING LOCATION
PUTAWAY</option>"
Response.Write "<option value='Picking'>PICKING</option>"
Response.Write "<option value='Receiving'>RECEIVING</option>"
Response.Write "<option value='Shorts'>SHORTS</option>"
Response.Write "<option value='Test'>TEST</option>"
Response.Write "</select>"
Response.Write "</tr>"
Response.Write "<tr>"
Response.Write "<td width='141' valign='top'>Comments:</td>"
Response.Write "<td width='784'>"
Response.Write "<textarea rows='7' name='comments' wrap='hard'
cols='54'></textarea></td>"
Response.Write "</tr>"
Response.Write "<tr>"
Response.Write "<td width='141' valign='top'> </td>"
Response.Write "<td width='784'> </td>"
Response.Write "</tr>"
Response.Write "<tr>"
Response.Write "<td width='141' valign='top'> </td>"
Response.Write "<td width='784'>"
Response.Write "<input type='submit' value='Send Message'
name='Send'></td>"
Response.Write "</tr>"
Response.Write "</table>"
Response.Write "</div>"
Response.Write "<input type='hidden' name='mode' value='Send'>"
Response.Write "</form>"
End Sub
'************************************************* ****************************
'* DATABASE APPENDING
*
'************************************************* ****************************
Sub Database()
'create db connection
Set dbconn = Server.CreateObject("ADODB.Connection")
'open db in a DSN-less method
dbconn.Open "PROVIDER=MICROSOFT.JET.OLEDB.4.0;DATA SOURCE="&
Server.MapPath("/jax/wh/Online_Forms/Secured_Archives/search_files/shortage.mdb")
'correct syntax for INSERT statement "INSERT INTO
<tablename>(<fieldname>) VALUES (<data>)"
stateSQL = "INSERT INTO verify (name, shift, carton, reason,
comments)" &_
"VALUES ('" & Replace(name,"'","''") & "','" & shift & "','" &
Replace(carton,"'","''") & "','" &_
reason & "','" & Replace(comments,"'","''") & "')"
'display results of statement on screen for testing purposes
'Response.Write(stateSQL)
'remind the SQL statement who it works for
dbconn.Execute(stateSQL)
'smack around the db connection until it lets go
dbconn.Close
'kill the connection with extreme prejudice
set dbconn = nothing
End Sub
'************************************************* ****
'*FUNCTION TO EMAIL PEOPLE DEPENDING ON REASON CHOSEN*
'************************************************* ****
Sub Email(value)
Set Mail = Server.CreateObject("Persits.MailSender")
Mail.Host = "gwfs1" ' Specify a valid SMTP server
Mail.From = "***@***.com" ' Specify sender's address
Mail.FromName = "290 / 110 Verification" ' Specify sender's name
Mail.IsHTML = True
Mail.Subject = Reason
Select Case value
Case "Conversions"
Mail.AddAddress DavePrivate
Mail.AddCC
Case "Test"
Mail.AddAddress DaveMiller
End Select
Dim mail_body
mail_body = "Name: " & Name & "<br>" &_
"Shift: " & Shift & "<br>" &_
"Carton: " & Carton & "<br>" &_
"Reason: " & Reason & "<br>" &_
"Comments: " & Comments & "<br>"
mail.body = mail_body & "Submitted IP Address: " &
request.servervariables("REMOTE_ADDR")
On Error Resume Next
Mail.Send
If Err <> 0 Then
Response.Write "Error encountered: " & Err.Description
End If
End Sub
'************************************************* ****************************
'* CONFIRMATION PAGE AFTER ENTERING DATA
*
'************************************************* ****************************
Sub Confirm()
Response.Write "<h2><img border='0'
src='../../images/success.jpg'></h2>"
Response.Write "<p>The following message has been successfully
submitted!</p>"
Response.Write "<p>Name: <font color='#0000FF'>" & Name &
"</font><br>"
Response.Write "Shift: <font color='#0000FF'>" & Shift &
"</font><br>"
Response.Write "Carton: <font color='#0000FF'>" & Carton &
"</font><br>"
Response.Write "Reason: <font color='#0000FF'>" & Reason &
"</font><br>"
Response.Write "Comments: <font color='#0000FF'>" & Comments &
"</font></p>"
Response.Write "<p> </p>"
End Sub
Response.Write "<p><img border='0'
src='../../images/shortage.jpg'></p>"
Response.Write "<title>290 / 110 Verification Form</title>"
If Mode <> "Send" Then
Call Form
End If
If Mode = "Send" Then
Call Email(value)
Call Database
Call Confirm
End If
Response.Write "<p><a href='../default.asp'>Return to Warehouse
Operations</a></p>"
%><!-- #INCLUDE VIRTUAL="/_borders/bottom_nav.asp" -->
</code>
"Mike" <me@here.com> wrote in message news:<uW**************@TK2MSFTNGP14.phx.gbl>...
Sorry, I guess I didn't pay enough attention to your post....And - I just
figured out that MailSender is a 3rd party component.
Anyways, regardless of # of email address, I think it would still be a good
idea to put those into a DB - so you can easily change them later and won't
have to change the actual source code in the asp page.
What I'm suggesting is to create a table with all of your Options. Then,
create another table that has email address; where each email address has a
link to the Options table (thus, every email address will have an
associated/linked option to it) Or, you can simply create one Table if you
don't have that much information and aren't concerned about Table
normalization.
Now, when you call the function (with the selected Option (sOption)), you
create a recordset that grabs all emails with Option as the criteria. Maybe
something like... - "Select EmailAddress from tblEmail WHERE Option ='" &
sOption & "';"
You can now loop through all of the emails in the recordset. I don't know
how the MailSender works, but you can loop through this email recordset to
create an EmailTo address string (separated by a coma), or send out
individual emails to each person within the loop structure.
This make sense?
"dmiller23462" <dm**********@yahoo.com> wrote in message
news:59**************************@posting.google.c om... Thanks for the reply, Mike....
Please forgive my ignorance (I'm still getting my head around ASP) but
since I've only got a total of 10 email addresses, I'll just make a
separate table in an Access DB for this (that's what your suggestions
sounds like to me) I'm not quite sure how I can incorporate RecordSets
(I use those for query-type pages so I have those figured out) into
the Persits email object.....
Basically I'm wondering how the mail object will know exactly which
email address to use.....Any more help?
"Mike" <me@here.com> wrote in message
news:<u9**************@TK2MSFTNGP14.phx.gbl>... How about a lookup table in a DB to hold all of the options and the email addresses that relate to it.
Then create a sub with the option selected to be passed in as a variable...? In the sub, you'll loop through all of the email addresses that have been return based on the user's option selection.
Does this help?
Sub EmailOption (sOption)
Set ConnEmail=Server.CreateObject("ADODB.Connection")
...
Set rsEmail=Server.CreateObject("ADODB.Recordset")
...
Set Mail = Server.CreateObject("Persits.MailSender")
....
End Sub
"dmiller23462" <dm**********@yahoo.com> wrote in message
news:59**************************@posting.google.c om...
> So here's my problem.....I need to set up different email
> distributions based on which option in the following Select form has
> been chosen....For instance if "Putaway" is chosen it needs to email
> Us***@here.whatever and Us***@here.whatever but if "Loaded" is chosen
> it needs to email Us***@here.whatever and Us***@here.whatever, etc,
> etc...
>
> I'm aware that the only thing that really needs to change is the
> "Mail.AddAddress" line (at least in my own mind that seems
> correct).....I was just kind of hoping to have something along the
> lines of ;
>
> Set Mail = Server.CreateObject("Persits.MailSender")
> Mail.Host = "xxxx"
> Mail.From = "me@me.com"
> Mail.FromName = "Test"
> Mail.IsHTML = True
> Mail.Subject = Reason
>
> If Reason = Putaway Then
> Mail.AddAddress User1Variable
> Mail.AddAddress User4Variable
> ElseIf Reason = Loaded Then
> Mail.AddAddress User2Variable
> Mail.AddAddress User3Variable
> End If
>
> Hopefully you understand the gist of what I'm attempting....I know
> that an ElseIf statement may not be the best method but that's why I'm
> posting...
>
> Here's the Select that I refer to....
>
> Response.Write "<select size='1' name='reason' tabindex='8'>"
> Response.Write "<option value='Putaway'>CASE PUTAWAY</option>"
> Response.Write "<option value='Conversions'>CONVERSIONS</option>"
> Response.Write "<option value='Drivers'>DRIVER TEAM</option>"
> Response.Write "<option value='Inspections'>INSPECTIONS</option>"
> Response.Write "<option value='Invoiced'>INVOICED</option>"
> Response.Write "<option value='Label'>LABEL REPLACES</option>"
> Response.Write "<option value='Loaded'>LOADED</option>"
> Response.Write "<option value='Located'>LOCATED STATUS</option>"
> Response.Write "<option value='Manifested'>MANIFESTED</option>"
> Response.Write "<option value='Other'>OTHER</option>"
> Response.Write "<option value='Packed'>PACKED STATUS</option>"
> Response.Write "<option value='Pending'>PENDING LOCATION
> PUTAWAY</option>"
> Response.Write "<option value='Picking'>PICKING</option>"
> Response.Write "<option value='Receiving'>RECEIVING</option>"
> Response.Write "<option value='Shorts'>SHORTS</option>"
> Response.Write "<option value='Test'>TEST</option>"
> Response.Write "</select>"
>
> Any suggestions/advice/pointers/URLs would be extremely helpful...(I
> haven't posted the code in its entirety, only what I think you could
> use to look at...If you want the entire length of code, please let me
> know and I'll post it if necessary....)