|
 |
asp_cdo thread: Sending Email
Message #1 by "Savonnya D. Rodrigues" <srod@f...> on Fri, 9 Feb 2001 09:41:16 -0600
|
|
> I was trying to send users an email with there password. I used the code
> from sending emails in asp using cdonts. It ran but I did not get an
> email. Is there something I am doing wrong. I put this code right after
> it checks to see if an error message if any. Please HELP!!!!
> <%
> '-- Error message if there is any
> Response.write (strError & "<BR>")
>
> %>
>
> <%
> If Request.Form="FormAction" then
>
> Dim objCDO, obj1CDO
> Set objCDO
> Server.CreateObject("CDONTS.NewMail")
>
> 'Create the recordset object
> Set obj1CDO = Server.CreateObject("ADODB.Recordset")
>
> 'Open the recordset getting a list of all Users Name
> obj1CDO.Open "Select * from UserLoginInfo ","DSN=ESS"
>
> ' This code assumes the above CDO
> 'instantiation code is included
> objCDO.To = Request.Form("Email")
> objCDO.From = "time@t..."
>
> Dim txtSubject
> txtSubject = Request.Form("Name") & " your
> password is "& Request.Form("Password")
> objCDO.Subject = "Your Password"
> objCDO.Body = txtSubject
> objCDO.Send
> 'Close and dereference database objects
> obj1CDO.Close
> Set obj1CDO=Nothing
> End If
>
> %>
----- Original Message -----
From: "Peter Lanoie" <planoie@e...>
To: "ASP Databases" <asp_databases@p...>
Sent: Thursday, January 25, 2001 11:27 AM
Subject: [asp_databases] Re: Update (question)
> You don't have any WHERE clause in the SQL... the update will update all
the
> records without that restriction.
>
> Your original post contained "where Serial Num='" &
> Request.Form("txtSerialNum") &"'"
> If that's not making it onto the update query, which it doesn't look like
it
> is...then the update applies to ALL records.
> The field name you have in there is "Serial Num", that might be the
problem.
> A space in the field name could be a problem. If you need to, put that
> field name in ' or maybe use the [ ] characters:
>
> "where 'Serial Num'='" & Request.Form("txtSerialNum") &"'"
> or
> "where [Serial Num]='" & Request.Form("txtSerialNum") &"'"
>
> Give that a shot and see what you get.
>
> Good Luck,
> -Peter L
>
> -----Original Message-----
> From: Savonnya D. Rodrigues [mailto:srod@f...]
> Sent: Thursday, January 25, 2001 10:47 AM
> To: ASP Databases
> Subject: [asp_databases] Re: Update (question)
>
>
> I did the response.write with the update statement and it updated, but
when
> it entered into the access database it updated everthing. Is there
something
> I am missing in my update statement? Below, is the respose.write that I
> executed using the response.write.
>
> The following update string was executed and the values updated in the
> Hardware table.
>
> Update Computer Set SerialNum = '34444',PNNum = '8',ComputerName
> '8',UserName ='',IPAddr
> '',NodePrinterID = '',Manufacture = 'HP',ProductName ='vectra',Version
> 'series',Description
> ='desktop',Status = 'In Use',UserID = '',Comment =' 'The following update
> string was executed and the
> values updated in the Hardware table.
>
> Update PurchaseOrder Set SerialNum = '34444',POComment = '8',PCQuote
> '',DateReceived
> '12:00:39',DateApproved = '12:00:39',Cost = '32',MaintenanceAgree
> '8',LicenseLocation = '8'
> ----- Original Message -----
> From: "Imar Spaanjaars" <Imar@S...>
> To: "ASP Databases" <asp_databases@p...>
> Sent: Thursday, January 25, 2001 1:34 AM
> Subject: [asp_databases] Re: Update (question)
>
>
> > Usually what helps when you have problems like this, is to write the SQL
> > statement to the browser. Then copy and paste the query in Access or in
> SQL
> > server to see if it works there.
> > Usually, you see right away what the problem is (or the database will
tell
> > you).
> >
> > So do a Response.Write(strSQL1) before you execute the query. If it
still
> > doesn't work, post the results of the Response.Write to this list.
> >
> > Imar
> >
> >
> > At 05:13 PM 1/24/2001 -0600, you wrote:
> > >I have two update statements to update my tables in two locations.
> > >Everything is working fine, but when I try to update on record it
updates
> > >the whole table. I used the where clause and it did not change
anything.
> Do
> > >you have any suggestions?
> > >
> > >
> > >strSQL1 = "Update Computer Set " & "SerialNum = '" &
> > >Request.Form("txtSerialNum") & "'," & "PNNum = '" &
> Request.Form("txtPNNum")
> > >& "'," & "ComputerName = '" & Request.Form("txtComputerName") & "'," &
> > >"UserName ='" & Request.Form("txtUserName") & "'," & "IPAddr = '" &
> > >Request.Form("txtIPAddr") & "'," & "NodePrinterID = '" &
> > >Request.Form("txtNodePrinterID") & "'," & "Manufacture = '" &
> > >Request.Form("txtManufacture") & "'," & "ProductName ='" &
> > >Request.Form("txtProductName") & "'," & "Version = '" &
> > >Request.Form("txtVersion") & "'," & "Description ='" &
> > >Request.Form("txtDescription") & "'," & "Status = '" &
> > >Request.Form("txtStatus") & "'," & "UserID = '" &
> Request.Form("txtUserID")
> > >& "'," & "Comment =' " & Request.Form("txtComment") & "' where Serial
Num
>
> > >'" & Request.Form("txtSerialNum") &"'"
> > >
> > >strSQL2 = "Update PurchaseOrder Set " & "SerialNum = '" &
> > >Request.Form("txtSerialNum") & "'," & "POComment = '" &
> > >Request.Form("txtPOComment") & "'," & "PCQuote = '" &
> > >Request.Form("txtPCQoute") & "'," & "DateReceived = '" &
> > >Request.Form("txtDateReceived") & "'," & "DateApproved = '" &
> > >Request.Form("txtDateApproved") & "'," & "Cost = '" &
> > >Request.Form("txtCost") & "'," & "MaintenanceAgree = '" &
> > >Request.Form("txtMaintenanceAgree") & "',"& "LicenseLocation = '" &
> > >Request.Form("txtLicenseLocation") & "'where Serial Num = '" &
> > >Request.Form("txtSerialNum") &"'"
> >
>
>
Message #2 by "Matthew Lohr" <mlohr@t...> on Fri, 9 Feb 2001 11:28:27 -0500
|
|
did you check the mail queue to see if any mail was sitting in there? Look
in there and look at the bad mail directory to see if your messages are just
sitting
-----Original Message-----
From: Savonnya D. Rodrigues [mailto:srod@f...]
Sent: Friday, February 09, 2001 7:06 PM
To: ASP CDO
Subject: [asp_cdo] Sending Email
> I was trying to send users an email with there password. I used the code
> from sending emails in asp using cdonts. It ran but I did not get an
> email. Is there something I am doing wrong. I put this code right after
> it checks to see if an error message if any. Please HELP!!!!
> <%
> '-- Error message if there is any
> Response.write (strError & "<BR>")
>
> %>
>
> <%
> If Request.Form="FormAction" then
>
> Dim objCDO, obj1CDO
> Set objCDO
> Server.CreateObject("CDONTS.NewMail")
>
> 'Create the recordset object
> Set obj1CDO = Server.CreateObject("ADODB.Recordset")
>
> 'Open the recordset getting a list of all Users Name
> obj1CDO.Open "Select * from UserLoginInfo ","DSN=ESS"
>
> ' This code assumes the above CDO
> 'instantiation code is included
> objCDO.To = Request.Form("Email")
> objCDO.From = "time@t..."
>
> Dim txtSubject
> txtSubject = Request.Form("Name") & " your
> password is "& Request.Form("Password")
> objCDO.Subject = "Your Password"
> objCDO.Body = txtSubject
> objCDO.Send
> 'Close and dereference database objects
> obj1CDO.Close
> Set obj1CDO=Nothing
> End If
>
> %>
Message #3 by "Savonnya D. Rodrigues" <srod@f...> on Fri, 9 Feb 2001 11:03:51 -0600
|
|
I did check the queue and there was nothing in it. When I create an object
what do I have to have in the Server.CreateObject("CDONTS.NewMail")? The
reason I am asking is because I am using windows 2000.
----- Original Message -----
From: "Matthew Lohr" <mlohr@t...>
To: "ASP CDO" <asp_cdo@p...>
Sent: Friday, February 09, 2001 10:28 AM
Subject: [asp_cdo] RE: Sending Email
> did you check the mail queue to see if any mail was sitting in there?
Look
> in there and look at the bad mail directory to see if your messages are
just
> sitting
>
> -----Original Message-----
> From: Savonnya D. Rodrigues [mailto:srod@f...]
> Sent: Friday, February 09, 2001 7:06 PM
> To: ASP CDO
> Subject: [asp_cdo] Sending Email
>
>
> > I was trying to send users an email with there password. I used the code
> > from sending emails in asp using cdonts. It ran but I did not get an
> > email. Is there something I am doing wrong. I put this code right after
> > it checks to see if an error message if any. Please HELP!!!!
> > <%
> > '-- Error message if there is any
> > Response.write (strError & "<BR>")
> >
> > %>
> >
> > <%
> > If Request.Form="FormAction" then
> >
> > Dim objCDO, obj1CDO
> > Set objCDO
> > Server.CreateObject("CDONTS.NewMail")
> >
> > 'Create the recordset object
> > Set obj1CDO = Server.CreateObject("ADODB.Recordset")
> >
> > 'Open the recordset getting a list of all Users Name
> > obj1CDO.Open "Select * from UserLoginInfo ","DSN=ESS"
> >
> > ' This code assumes the above CDO
> > 'instantiation code is included
> > objCDO.To = Request.Form("Email")
> > objCDO.From = "time@t..."
> >
> > Dim txtSubject
> > txtSubject = Request.Form("Name") & " your
> > password is "& Request.Form("Password")
> > objCDO.Subject = "Your Password"
> > objCDO.Body = txtSubject
> > objCDO.Send
> > 'Close and dereference database objects
> > obj1CDO.Close
> > Set obj1CDO=Nothing
> > End If
> >
> > %>
>
Message #4 by "Matthew Lohr" <mlohr@t...> on Fri, 9 Feb 2001 14:31:36 -0500
|
|
I included the code I use for a windows 2000 server. I really didn't notice
anything wrong with yours but I am no expert so if you want to try mine just
to see if it works for you then add the code for your database in try this
Dim myMail 'Variable for the mail object
Dim strFrom
strFrom = Trim(Request("from"))
Dim strTo
strTo = Trim(Request("to"))
Dim strmsgsubj
strmsgsubj = Trim(Request("msgsubj")) 'String variable to hold the body of
the message
Dim strmsgbody
strmsgbody = Trim(Request("msgbody")& vbcrlf & vbcrlf & vbcrlf &_
"this mail was sent using " & "www.mailmefree.com/recmail.htm")
'String variable to hold the body of the message
Set myMail = Server.CreateObject("CDONTS.NewMail")
myMail.Subject = strmsgsubj
myMail.Body = strmsgBody 'The body of the message
myMail.To = strTo 'Where the message is going
myMail.From = strFrom
myMail.Send 'sends the email
-----Original Message-----
From: Savonnya D. Rodrigues [mailto:srod@f...]
Sent: Friday, February 09, 2001 12:04 PM
To: ASP CDO
Subject: [asp_cdo] RE: Sending Email
I did check the queue and there was nothing in it. When I create an object
what do I have to have in the Server.CreateObject("CDONTS.NewMail")? The
reason I am asking is because I am using windows 2000.
----- Original Message -----
From: "Matthew Lohr" <mlohr@t...>
To: "ASP CDO" <asp_cdo@p...>
Sent: Friday, February 09, 2001 10:28 AM
Subject: [asp_cdo] RE: Sending Email
> did you check the mail queue to see if any mail was sitting in there?
Look
> in there and look at the bad mail directory to see if your messages are
just
> sitting
>
> -----Original Message-----
> From: Savonnya D. Rodrigues [mailto:srod@f...]
> Sent: Friday, February 09, 2001 7:06 PM
> To: ASP CDO
> Subject: [asp_cdo] Sending Email
>
>
> > I was trying to send users an email with there password. I used the code
> > from sending emails in asp using cdonts. It ran but I did not get an
> > email. Is there something I am doing wrong. I put this code right after
> > it checks to see if an error message if any. Please HELP!!!!
> > <%
> > '-- Error message if there is any
> > Response.write (strError & "<BR>")
> >
> > %>
> >
> > <%
> > If Request.Form="FormAction" then
> >
> > Dim objCDO, obj1CDO
> > Set objCDO
> > Server.CreateObject("CDONTS.NewMail")
> >
> > 'Create the recordset object
> > Set obj1CDO = Server.CreateObject("ADODB.Recordset")
> >
> > 'Open the recordset getting a list of all Users Name
> > obj1CDO.Open "Select * from UserLoginInfo ","DSN=ESS"
> >
> > ' This code assumes the above CDO
> > 'instantiation code is included
> > objCDO.To = Request.Form("Email")
> > objCDO.From = "time@t..."
> >
> > Dim txtSubject
> > txtSubject = Request.Form("Name") & " your
> > password is "& Request.Form("Password")
> > objCDO.Subject = "Your Password"
> > objCDO.Body = txtSubject
> > objCDO.Send
> > 'Close and dereference database objects
> > obj1CDO.Close
> > Set obj1CDO=Nothing
> > End If
> >
> > %>
>
|
|
 |