Hi All,
Well- this question might have appeared several times on this forum- but would appreciate your reply on this:
I have a asp page, where customers login with some username and the pwd, which are stored in sql. i should be using this user name and pwd and check if it is the same as the userid and the pwd in the sql 4 table..IF so then:
display the download url which is in sql3 by querying the four tables..
These four tables are stored in MS Access.
sql1-id, name: Columns
sql2-id, email id
sql3-id, contract number, maintenance start date, maintenance exp date, download url, main email id, maintenance status,
sql4- user id, pwd, account name
So - this is the code- ihave written ,please tell me where the error is:
ONce the display of the URL is complete, then I am using CDOSYS to send an email to the email address int he sql2, for which i have written the code ..
I am getting internal server error 500...
please help in this..
-tanya
code is :
<%@ language
<% Option Explicit
'Declare Local Variables
Dim conn, strSQL
Dim strEmail,strUrl
Dim objMail, objRS
Dim strMessageBody, strDisclaimer
Dim sql1, sql2, sql3, sql4, UserName, Password
Dim ACCOUNT ID, ACCOUNT NAME, EMAIL ID
Dim CONTRACT NUMBER, MAINTENANCE_START_DATE_C, MAINTENANCE_EXPIRATION_DATE_C,downloadURL
Dim ESD Contact, MAINTENANCE_STATUS, User ID, Pwd
'End Variable Declaration
%>
<html><head><title>Posting Mail</title></head>
<body bgcolor=acqua leftmargin='1' topmargin='1'><table width='100%' height='100%' cellspacing='0' cellpadding='2'>
<tr align='left'><td height='100%' width='145' valign='top'></td><td width='555' valign='top' align='left'>
<%'get form elements and compose email
Function ReplaceSpecial(str)
If NOT IsNull(str) Then
ReplaceSpecial = Replace(str, "'", "''")
End If
End Function
'strEmail = Trim(ReplaceSpecial(Request.Form("User_Email")))
Set conn = Server.CreateObject("ADODB.Connection")
conn.Open "DSN=sql"
Set objRS = Server.CreateObject("ADODB.Recordset")
strSQL ="SELECT * FROM sql1, sql2, sql3, sql4 where sql3.User Id=Session (UserName) And Pwd=Session(Password)"
strSQL =strSQL & "And sql4.ACCOUNT NAME=sql1.ACCOUNT NAME And sql1.ACCOUNT ID=sql3.ACCOUNT ID"
strSQL =strSQL & " And sql2.EMAIL ID=sql3.ESD Contact WHERE (sql3.MAINTENANCE CONTRACT)='Y'"
objRS.open strSQL,conn
response.write strEmail
response.write strSQL
response.write objRS("sql3.download URL")
strEmail=objRS("sql3.ESD Contact")
If NOT objRS.EOF Then
'CREATE THE MESSAGE OBJECT
strUrl="http://" & objRS("sql3.download URL")
Set objMail = Server.CreateObject("CDO.Message")
'This section provides the configuration information for the remote SMTP server.
objMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2 'Send the message using the network (SMTP over the network).
objMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserver") ="mail.myserver.com"
objMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
objMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = False 'Use SSL for the connection (True or False)
objMail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 60
'End remote SMTP server configuration section
objMail.Subject = "Download your software "
objMail.From = "me@myserver.com"
objMail.To = strEmail
'objMail.MailFormat = 0 'MIME Format
'objMail.BodyFormat = 0
strMessageBody = "Hi, You can download from this site <a href='" & strUrl & "' > " & strUrl & "</a>"
strMessageBody = strMessageBody & "<br><br>Thank You,"
strDisclaimer = "<br><br><p><font color='#777777' size='-1.5' face='Arial'><i>This message may contain confidential and/or privileged information. If you are not the addressee or authorized to receive this for the addressee, you must not use, copy, disclose, or take any action based on this message or any information herein. If you have received this message in error, please advise the sender immediately by reply e-mail and delete this message. Thank you for your cooperation.</i></font>"
'objMail.Body = strMessageBody & strDisclaimer
objMail.HTMLBody= strMessageBody & strDisclaimer
objMail.Send
objRS.Close
Set objRS = Nothing
%>
<table>
<tr><td class="normal">Your request has been processed. Email address is: <%=strEmail%> Software URL is: <%=strUrl%>
</td></tr>
<tr><td class="normal"></td></tr>
<tr><td class="normal">Thank You</td></tr>
</table>
<%Else%>
<table>
<tr><td class="normal"><font size='+1' color='Red'><b>Your request could not be processed. You will need to check the information that was submitted </b></font></td></tr>
</table>
<%End If%>
</td>
</tr>
</table>
<hr>
</body>
</html>