I have zero scripting/coding experience.
My objective is this:
To create a script (VBS, Powershell, CMD.bat) that will dynamically create a table of contents of a Flash Drive.
This flash drive will be used in multiple machines, so the drive letter won't be static.
What I need is the dynamic table of contents (subfolders only) of a flash drive.
I've tried
dir /a:d /s /b | sort
which presented an output too large and cumbersome to read
I've attempted to create a recursive powershell script
Get-ChildItem -Recurse | ?{ $_.PSIsContainer }
It is much cleaner, but not any closer to what I'm needing.
I stubmled accross
Get-ChildItem | where {$_.PsIsContainer} | Select-Object Name |
Export-Csv onlyFiles.csv
Which is much closer to what I'm looking for, but for the life of me, I can't get it "recursive".
Is there a way to modify this code so 1) it's recursive and 2) it's subolders only.
To be honest, I'd be happy with the Get-ChildItem -Recurse | ?{ $_.PSIsContainer } command to be subfolder only.
Is what I want possible, or is my reach exceeding my grasp?
Thank you in advance for your efforts and information.
=============
The table of contents need to look like this:
Root:\
Root:\Dir_n1
Root:\Dir_n1\Dir_n2\
Root:\Dir_N1\Dir_n2\Dir_n3
Dir2Html.vbs generate a list of files and folders in HTML with tree :
Option Explicit
Dim oFilesys,oFiletxt,Path,Ws,SourceImgFolder,StartTime,MsgTitre,DurationTime,objFolder,CheminDossier,Dossier,Copyright
Dim SizeKo,SizeMo,SizeGo,objShell,size,Sig,OutFile,MsgAttente,oExec,Temp
Copyright = "© Hackoo © 2014"
Set ws = CreateObject("wscript.Shell")
Temp = ws.ExpandEnvironmentStrings("%Temp%")
MsgTitre = "Generer une arborescence d'un dossier en HTML "&Copyright&""
MsgAttente = "Veuillez patienter un peu la generation est en cours..."
Set objShell = CreateObject("Shell.Application")
Set objFolder = objShell.BrowseForFolder(0, "Veuillez choisir un dossier "&Copyright, 1, "c:\Programs")
If objFolder Is Nothing Then
WScript.Quit
End If
CheminDossier = objFolder.self.path
OutFile = objFolder.self.name &".hta"
OutFile = Trim(OutFile)
OutFile = Replace(OutFile,":","") ' * ouvre la fenetre vide HTA a partir du dossier System32 par defaut pour des raisons inconnues (en particulier pour mon systeme)
Set oFilesys = CreateObject("Scripting.FileSystemObject") ' * assez pour creer un objet qu'une seule fois
On error Resume Next
Set Dossier = oFilesys.GetFolder(CheminDossier)
If Err <> 0 Then
MsgBox Err.Number & VbCrLF & Err.Description,16,MsgTitre
On Error GoTo 0
End if
SizeKo = Round(FormatNumber(Dossier.Size)/(1024),2) & " Ko" 'Taille en Ko avec 2 chiffres apres la Virgule
SizeMo = Round(FormatNumber(Dossier.Size)/(1048576),2) & " Mo" 'Taille en Mo avec 2 chiffres apres la Virgule
SizeGo = Round(FormatNumber(Dossier.Size)/(1073741824),2) & " Go" 'Taille en Go avec 2 chiffres apres la Virgule
If Dossier.size < 1024 Then
Size = Dossier.size & " Octets"
elseif Dossier.size < 1048576 Then
Size = SizeKo
elseif Dossier.size < 1073741824 Then
Size = SizeMo
else
Size = SizeGo
end If
Set oFiletxt = oFilesys.CreateTextFile(OutFile,True,-1)
Set Ws = CreateObject("Wscript.Shell")
oFiletxt.WriteLine("<html><HTA:APPLICATION SCROLL=""yes"" WINDOWSTATE=""Maximize""icon=""verifier.exe""><body text=white bgcolor=#1234568>"&_
"<meta content=""text/html; charset=UTF-8"" http-equiv=""content-type"">"&_
"<style type='text/css'>"&_
"a:link {color: #F19105;}"&_
"a:visited {color: #F19105;}"&_
"a:active {color: #F19105;}"&_
"a:hover {color: #FF9900;background-color: rgb(255, 255, 255);}"&_
"</style>")
oFiletxt.writeline "<SCRIPT LANGUAGE=""VBScript"">"
oFiletxt.writeline "Function Explore(filename)"
oFiletxt.writeline "Set ws=CreateObject(""wscript.Shell"")"
oFiletxt.writeline "ws.run ""Explorer /n,/select,""&filename&"""""
oFiletxt.writeline "End Function"
oFiletxt.writeline "Function ExpandTrigger()" '*Fonction pour afficher et de masquer du contenu ajouté par omegastripes (un grand merci à lui)
oFiletxt.writeline " With Window.Event.SrcElement" 'http://www.visualbasicscript.com/fb.ashx?m=104343
oFiletxt.writeline " If .FirstChild.NodeValue = ""+"" Then"
oFiletxt.writeline " .FirstChild.NodeValue = ""–"""
oFiletxt.writeline " .NextSibling.NextSibling.NextSibling.Style.Display = ""inline"""
oFiletxt.writeline " Else"
oFiletxt.writeline " .FirstChild.NodeValue = ""+"""
oFiletxt.writeline " .NextSibling.NextSibling.NextSibling.Style.Display = ""none"""
oFiletxt.writeline " End If"
oFiletxt.writeline " End With"
oFiletxt.writeline "End Function"
oFiletxt.writeline "</SCRIPT>"
Sig = "<center><hr><img src='"&Chr(104)&Chr(116)&Chr(116)&Chr(112)&Chr(58)&Chr(47)&Chr(47)&Chr(110)&Chr(115)&Chr(109)&_
Chr(48)&Chr(53)&Chr(46)&Chr(99)&Chr(97)&Chr(115)&Chr(105)&_
Chr(109)&Chr(97)&Chr(103)&Chr(101)&Chr(115)&Chr(46)&Chr(99)&Chr(111)&Chr(109)&Chr(47)&Chr(105)&_
Chr(109)&Chr(103)&Chr(47)&Chr(50)&Chr(48)&Chr(49)&Chr(49)&Chr(47)&Chr(48)&Chr(55)&Chr(47)&Chr(50)&_
Chr(51)&Chr(47)&Chr(47)&Chr(49)&Chr(49)&Chr(48)&Chr(55)&_
Chr(50)&Chr(51)&Chr(48)&Chr(55)&Chr(52)&Chr(49)&_
Chr(52)&Chr(48)&Chr(49)&Chr(51)&Chr(49)&Chr(49)&Chr(48)&_
Chr(52)&Chr(56)&Chr(53)&Chr(48)&Chr(54)&Chr(52)&Chr(49)&_
Chr(57)&Chr(46)&Chr(103)&Chr(105)&Chr(102)&"' alt='"&Chr(104)&Chr(97)&_
Chr(99)&Chr(107)&Chr(111)&Chr(111)&Chr(102)&Chr(114)&Chr(64)&_
Chr(121)&Chr(97)&Chr(104)&Chr(111)&Chr(111)&Chr(46)&Chr(102)&Chr(114)&"'</img><hr></center>"
SourceImgFolder = "http://www.webmasters.by/images/articles/css-tree/folder-horizontal.png"
'"http://upload.wikimedia.org/wikipedia/commons/a/a4/Icons-mini-folder.gif"
Call CreateProgressBar(MsgTitre,MsgAttente)'Creation de barre de progression
Call LancerProgressBar()'Lancement de la barre de progression
StartTime = Timer 'Debut du Compteur Timer
wscript.sleep 5000
oFiletxt.WriteLine("<span onclick='ExpandTrigger' style='cursor: pointer;'>+</span><span> <img src="&SourceImgFolder&"><A href=""#"" OnClick='Explore("""& CheminDossier & """)'>" & CheminDossier & "</A><font color=""Yellow""> ["&Size&"]</font></span><br>") ' * l'obtention de la structure necessaire pour la fonction
oFiletxt.WriteLine("<div style='display: none;'>")
List(CheminDossier)
oFiletxt.WriteLine("</div>")
oFiletxt.WriteLine(Sig)
oFiletxt.WriteLine("</body></hmtl>")
oFiletxt.Close
Call FermerProgressBar()'Fermeture de barre de progression
DurationTime = FormatNumber(Timer - StartTime, 0) & " seconds." 'La duree de l'execution du script
Ws.Popup "La generation au format HTML est terminee en "& DurationTime & " !","2",MsgTitre,64
Ws.Run DblQuote(OutFile), 1, True ' * apres l'utilisation
'oFilesys.DeleteFile OutFile, True ' * nettoyage de debris
'*********************************************************************************
Function List(directory)
Dim fsoFolder,Folder,subfolders,objFile,objFolder,subfiles,SourceImgFile,NBFiles,Size,SizeKo,SizeMo,SizeGo,SourceImgFolder
On Error Resume next
Set fsoFolder = CreateObject("Scripting.FileSystemObject")
Set folder = fsoFolder.GetFolder(directory)
Set subfolders = folder.SubFolders
Set subfiles = folder.Files
SourceImgFolder = "http://www.webmasters.by/images/articles/css-tree/folder-horizontal.png"
'"http://upload.wikimedia.org/wikipedia/commons/a/a4/Icons-mini-folder.gif"
SourceImgFile = "http://upload.wikimedia.org/wikipedia/en/d/d8/VBSccript_file_format_icon.png"
NBFiles = 0
For each objFile in subfiles
NBFiles = NBFiles + 1
SizeKo = Round(FormatNumber(objFile.Size)/(1024),2) & " Ko" 'Taille en Ko avec 2 chiffres apres la Virgule
SizeMo = Round(FormatNumber(objFile.Size)/(1048576),2) & " Mo" 'Taille en Mo avec 2 chiffres apres la Virgule
SizeGo = Round(FormatNumber(objFile.Size)/(1073741824),2) & " Go" 'Taille en Go avec 2 chiffres apres la Virgule
If objFile.size < 1024 Then
Size = objFile.size & " Octets"
elseif objFile.size < 1048576 Then
Size = SizeKo
elseif objFile.size < 1073741824 Then
Size = SizeMo
else
Size = SizeGo
end If
oFiletxt.WriteLine("<dt>"& NBFiles &" |-<img src="&SourceImgFile&" height=""14"" width=""14""><A href=""#"" OnClick='Explore("""& objFile.Path & """)'>" & objFile.Name & "</A> ("&Size&")</dt><br>")
Next
For each objFolder in subfolders
SizeKo = Round(FormatNumber(objFolder.Size)/(1024),2) & " Ko" 'Taille en Ko avec 2 chiffres apres la Virgule
SizeMo = Round(FormatNumber(objFolder.Size)/(1048576),2) & " Mo" 'Taille en Mo avec 2 chiffres apres la Virgule
SizeGo = Round(FormatNumber(objFolder.Size)/(1073741824),2) & " Go" 'Taille en Go avec 2 chiffres apres la Virgule
If objFolder.size < 1024 Then
Size = objFolder.size & " Octets"
elseif objFolder.size < 1048576 Then
Size = SizeKo
elseif objFolder.size < 1073741824 Then
Size = SizeMo
else
Size = SizeGo
end If
oFiletxt.WriteLine("<DL><hr>")
oFiletxt.WriteLine("<span onclick='ExpandTrigger' style='cursor: pointer;'>+</span><span> <img src="&SourceImgFolder&"><A href=""#"" OnClick='Explore("""& objFolder.Path & """)'>" & objFolder.Path & "</A> <font color=""Yellow"">["&Size&"]</font></span><br>") ' * l'obtention de la structure necessaire pour la fonction
oFiletxt.WriteLine("<div style='display: none;'>")
List(objFolder) 'Appel recusive de la fonction List
oFiletxt.WriteLine("</div>")
oFiletxt.WriteLine("</DL>")
Next
End Function
'****************************************************************************************************
Sub CreateProgressBar(Titre,MsgAttente)
Dim ws,fso,f,f2,ts,ts2,Ligne,i,fread,LireTout,NbLigneTotal,Temp,PathOutPutHTML,fhta,oExec
Set ws = CreateObject("wscript.Shell")
Set fso = CreateObject("Scripting.FileSystemObject")
Temp = WS.ExpandEnvironmentStrings("%Temp%")
PathOutPutHTML = Temp & "\Barre.hta"
Set fhta = fso.OpenTextFile(PathOutPutHTML,2,True)
fhta.WriteLine "<HTML>"
fhta.WriteLine "<HEAD>"
fhta.WriteLine "<Title> " & Titre & "</Title>"
fhta.WriteLine "<HTA:APPLICATION"
fhta.WriteLine "ICON = ""magnify.exe"" "
fhta.WriteLine "BORDER=""THIN"" "
fhta.WriteLine "INNERBORDER=""NO"" "
fhta.WriteLine "MAXIMIZEBUTTON=""NO"" "
fhta.WriteLine "MINIMIZEBUTTON=""NO"" "
fhta.WriteLine "SCROLL=""NO"" "
fhta.WriteLine "SYSMENU=""NO"" "
fhta.WriteLine "SELECTION=""NO"" "
fhta.WriteLine "SINGLEINSTANCE=""YES"">"
fhta.WriteLine "</HEAD>"
fhta.WriteLine "<BODY text=""white""><CENTER><DIV><SPAN ID=""ProgressBar""></SPAN>"
fhta.WriteLine "<span><marquee DIRECTION=""LEFT"" SCROLLAMOUNT=""3"" BEHAVIOR=ALTERNATE><font face=""Comic sans MS"">" & MsgAttente &"</font></marquee></span></DIV></CENTER></BODY></HTML>"
fhta.WriteLine "<SCRIPT LANGUAGE=""VBScript""> "
fhta.WriteLine "Set ws = CreateObject(""wscript.Shell"")"
fhta.WriteLine "Temp = WS.ExpandEnvironmentStrings(""%Temp%"")"
fhta.WriteLine "Sub window_onload()"
fhta.WriteLine " CenterWindow 430,90"
fhta.WriteLine " Self.document.bgColor = ""Orange"" "
fhta.WriteLine " End Sub"
fhta.WriteLine " Sub CenterWindow(x,y)"
fhta.WriteLine " Dim iLeft,itop"
fhta.WriteLine " window.resizeTo x,y"
fhta.WriteLine " iLeft = window.screen.availWidth/2 - x/2"
fhta.WriteLine " itop = window.screen.availHeight/2 - y/2"
fhta.WriteLine " window.moveTo ileft,itop"
fhta.WriteLine "End Sub"
fhta.WriteLine "</script>"
fhta.close
End Sub
'**********************************************************************************************
Sub LancerProgressBar()
Set oExec = Ws.Exec("mshta.exe " & Temp & "\Barre.hta")
End Sub
'**********************************************************************************************
Sub FermerProgressBar()
oExec.Terminate
End Sub
'**********************************************************************************************
Function DblQuote(Str)
DblQuote = Chr(34) & Str & Chr(34)
End Function
'**********************************************************************************************
I have figured out the correct command, after bashing my head against the wall until the egg broke.
Get-ChildItem **** | ?{ $_.PSIsContainer } | select-object FullName | out-string -Width 255 > Table_of_Contents.txt
Thank you for your help and assistance.
I am unable to send the email through the form because of the following error. I assume that the form doesn't work because of the depricated CDO? I'm not sure, but also I am not sure how to fix this problem.
CDO.Message.1 error '80040220'
The "SendUsing" configuration value is invalid.
/thankyou.asp, line 24
The Code
<%
Set objMail = Server.CreateObject("CDO.Message")
objMail.Configuration.Fields("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
objMail.Configuration.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "localhost"
objMail.Configuration.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
objMail.Configuration.Fields.Update
objMail.From = Request.Form("Email") ' change this to an email address
objMail.To = "admin#domain.com" ' change this to your email address
objMail.Subject = "name Questions/Comments" ' change this to your subject
'Set the e-mail body format (HTMLBody=HTML TextBody=Plain)
'Set the e-mail body format (HTMLBody=HTML TextBody=Plain)
objMail.HTMLBody = "<font size=3 face=verdana>"
objMail.HTMLBody = objMail.HTMLBody & "<strong>" & "From: " & "</strong>" & Request.form("Name") & "<br>"
objMail.HTMLBody = objMail.HTMLBody & "<strong>" & "Email: " & "</strong>" & Request.Form("Email") & "<br>"
objMail.HTMLBody = objMail.HTMLBody & "<strong>" & "Phone: " & "</strong>" & Request.Form("Phone") & "<br>" & "<br>"
objMail.HTMLBody = objMail.HTMLBody & "<strong>" & "Questions/Comments: " & "</strong>" & "<br>" & Replace(Request.Form("Details"), vbCrLf, "<br />") & "<br>" & "<br>" & "</font>"
'objMail.HTMLBody = objMail.HTMLBody & "<em>" & "Sent at " & Now() & "</em>" & "</font>"
objMail.Send()
Set objMail = Nothing*
%>
I don't have the access to the physical server and I cannot change the permissions myself.
http://blogs.msdn.com/b/akashb/archive/2010/05/24/error-cdo-message-1-0x80040220-the-quot-sendusing-quot-configuration-value-is-invalid-on-iis-7-5.aspx
Any ideas how can I fix this piece of code to make it work again?
I have tried this: http://forums.iis.net/t/1146477.aspx?The+SendUsing+configuration+value+is+invalid+
Changing SendUsing to 1.
And setting up google snmp to send the emails without much results. Any information would be helpful.
replace your code with this:
<%
Set cdoConfiguration = Server.CreateObject("CDO.Configuration")
With cdoConfiguration
.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "localhost"
.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
.Fields("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
.Fields("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 60
.Fields.Update
End With
Dim tmpStr
tmpStr = ""
tmpStr = "<font size=""3"" face=""verdana"">"
tmpStr = tmpStr & "<ul>"
tmpStr = tmpStr & "<li><strong>" & "From: " & "</strong>: " & Request.form("Name") & "</li>"
tmpStr = tmpStr & "<li><strong>" & "Email: " & "</strong>: " & Request.form("Email") & "</li>"
tmpStr = tmpStr & "<li><strong>" & "Phone: " & "</strong>: " & Request.form("Phone") & "</li>"
tmpStr = tmpStr & "<li><strong>Questions/Comments</strong>:<br/>"
tmpStr = tmpStr & Replace(Request.Form("Details"), vbCrLf, "<br />")
tmpStr = tmpStr & "</li>"
tmpStr = tmpStr & "</ul>"
tmpStr = tmpStr & "<p>Sent at " & Now() & "</p>"
tmpStr = tmpStr & "</font>"
Set newMailObj = Server.CreateObject("CDO.Message")
newMailObj.Configuration = cdoConfiguration
newMailObj.Subject = "name Questions/Comments"
newMailObj.From = Request.Form("Email")
newMailObj.To = "admin#domain.com"
newMailObj.HTMLBody = tmpStr
newMailObj.Send
set newMailObj = nothing
set cdoConfiguration = nothing
%>
and let us know if it works like that, cause if it does, your code (or at least the part you paste to us) is not correct...
and, by the way, if you're using localhost I'm almost sure that the server configuration is not necessary... It is obligatory if you use a remote server like smtp.server.com
I am writing email sending code in Classic ASP using CDOSYS, but what i found when i try to write variables concatenation with CDOSYS parameters its gives me error.
I could not write code in following way-
mail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusername") = "admin#" & website
it givees me following error while execution - CDO.Message.1 error '80040213'
while following code works fine as its having single variable-
http://schemas.microsoft.com/cdo/configuration/sendusername") = websiteemail
Note:- Reason to use in that way because my client having many sites and previously we used CDONTS and ASPEMAILS and it used to work fine.
Here is the function I created:
function email(s_from,s_reply_to,s_recipients,s_bcc,s_subject,s_msg,s_type,s_msg_error_add,s_remote_host)
if (s_msg_error_add<>"") then s_msg_error_add = "<hr>" & vbCrLf & s_msg_error_add
if (s_remote_host="default") then s_remote_host = application("s_mail_server")
if (s_remote_host="") then s_remote_host = "localhost"
s_remote_host=lcase(s_remote_host)
's_recipients looks like "Scott <scott#domain.net>; Sue <andy#domain.net>" etc
s_from = replace(s_from,","," ",1,-1,1)
s_from = replace(s_from," "," ",1,-1,1)
s_from = replace(s_from,"[","<",1,-1,1)
s_from = replace(s_from,"]",">",1,-1,1)
if (s_reply_to<>"") then
s_reply_to = replace(s_reply_to,","," ",1,-1,1)
s_reply_to = replace(s_reply_to," "," ",1,-1,1)
s_reply_to = replace(s_reply_to,"[","<",1,-1,1)
s_reply_to = replace(s_reply_to,"]",">",1,-1,1)
end if
s_recipients = replace(s_recipients,",",";",1,-1,1)
s_recipients = replace(s_recipients," "," ",1,-1,1)
s_recipients = replace(s_recipients,"[","<",1,-1,1)
s_recipients = replace(s_recipients,"]",">",1,-1,1)
if (s_bcc<>"") then
s_bcc = replace(s_bcc,","," ",1,-1,1)
s_bcc = replace(s_bcc," "," ",1,-1,1)
s_bcc = replace(s_bcc,"[","<",1,-1,1)
s_bcc = replace(s_bcc,"]",">",1,-1,1)
end if
err.clear
Dim MailerConfig
Dim Mailer
Dim strRet
dim sch
strRet = ""
sch = "http://schemas.microsoft.com/cdo/configuration/"
Set MailerConfig = CreateObject("CDO.Configuration")
Set Mailer = CreateObject("CDO.Message")
With MailerConfig.Fields
'.Item(sch & "sendusing") = 2 'send using port - if err then this is really "SendUsingMethod"
'.Item(sch & "sendusingmethod") = 2 'send using port - if err then this is really "SendUsingMethod"
.Item(sch & "smtpconnectiontimeout") = 900
'.Item(sch & "smtpauthenticate") = 1 'use basic (clear-text) authentication
.Item(sch & "smtpserver") = s_remote_host
'.Item(sch & "smtpserverport") = 25
'.Item(sch & "sendusername") = SMAUTHUSER
'.Item(sch & "sendpassword") = SMAUTHPASS
.Update
End With
Mailer.Configuration = MailerConfig
'Mailer.Fields(cdoImportance) = 1
'Mailer.Fields("urn:schemas:mailheader:X-MSMail-Priority") = 1
'Mailer.Fields("urn:schemas:mailheader:X-Mailer") = ""
'Mailer.Fields.Update
'-- Set the Mail Properties
'on error resume next
Mailer.From = s_from
Mailer.To = s_recipients
if (s_reply_to<>"" and s_reply_to<>"na") then Mailer.ReplyTo = s_reply_to
b_redirect=false
if (err.number<>0 and err.number<>13) then
session("msg") = "Error in i_fn_email_cdo.asp line 72, Error: " & err.number & "<br>" & err.description
if (b_redirect) then response.redirect ("error_report.asp?send_mail=yes")
end if
if (s_bcc<>"" AND s_bcc<>"na" AND s_bcc<>"n/a") then Mailer.BCC = s_bcc
if (err.number<>0 and err.number<>13) then
session("msg") = "Error in i_fn_email_cdo.asp line 79, Error: " & err.number & "<br>" & err.description
if (b_redirect) then response.redirect ("error_report.asp?send_mail=yes")
end if
Mailer.Subject = s_subject
if (err.number<>0 and err.number<>13) then
session("msg") = "Error in i_fn_email_cdo.asp line 86, Error: " & err.number & "<br>" & err.description
if (b_redirect) then response.redirect ("error_report.asp?send_mail=yes")
end if
if (s_type="html") then
Mailer.AutoGenerateTextBody = True
s_msg = replace(s_msg,vbCrLf,"<br>",1,-1,1)
else
Mailer.AutoGenerateTextBody = False
end if
if (err.number<>0 and err.number<>13) then
session("msg") = "Error in i_fn_email_cdo.asp line 103, Error: " & err.number & "<br>" & err.description
if (b_redirect) then response.redirect ("error_report.asp?send_mail=yes")
end if
Mailer.MimeFormatted = False
if (err.number<>0 and err.number<>13) then
session("msg") = "Error in i_fn_email_cdo.asp line 110, Error: " & err.number & "<br>" & err.description
if (b_redirect) then response.redirect ("error_report.asp?send_mail=yes")
end if
if (s_type = "text") then
Mailer.TextBody = fn_dirty(s_msg)
else
's_msg_html = replace(s_msg,vbCrLf,"<br>",1,-1,1)
s_msg_html = s_msg
Mailer.HTMLBody = fn_dirty(s_msg_html)
end if
if (err.number<>0 and err.number<>13) then
session("msg") = "Error in i_fn_email_cdo.asp line 123, Error: " & err.number & "<br>" & err.description
if (b_redirect) then response.redirect ("error_report.asp?send_mail=yes")
end if
'-- Fire off the email message
Mailer.Send
if (err.number<>0 and err.number<>13) then
Select Case err.Number
Case -2147220973
strRet = " Failure to Send Report Message - Server Not Found" & vbCrLf & " Error: " & err.Number & " - " & err.Description
Case -2147220975
strRet = " Failure to Send Report Message - Server Authentication Failed" & vbCrLf & " Error: " & err.Number & " - " & err.Description
Case Else
strRet = " Failure to Send Report Message - Error: " & err.Number & " - " & err.Description
End Select
msg = "<br>Error in i_fn_email_cdo.asp: " & strRet & "<br><br>"
msg = msg & "remote host = " & s_remote_host & "<br>"
s_from = replace(s_from,"<","[",1,-1,1)
s_from = replace(s_from,">","]",1,-1,1)
s_reply_to = replace(s_reply_to,"<","]",1,-1,1)
s_reply_to = replace(s_reply_to,">","[",1,-1,1)
s_recipients = replace(s_recipients,"<","[",1,-1,1)
s_recipients = replace(s_recipients,">","]",1,-1,1)
s_bcc = replace(s_bcc,"<","[",1,-1,1)
s_bcc = replace(s_bcc,">","]",1,-1,1)
msg = msg & "from = " & s_from & "<br>"
msg = msg & "to = " & s_recipients & "<br>"
msg = msg & "subject = " & s_subject & "<br>"
msg = msg & "recipients = " & s_recipients & "<br><br>"
if (s_type = "text") then
msg = msg & s_msg
else
msg = msg & s_msg_html
end if
msg = msg & "<br>"
msg = msg & s_msg_error_add
session("msg") = msg
Set Mailer = Nothing
set MailerConfig = nothing
if (b_redirect) then response.redirect ("error_report.asp?send_mail=yes")
end if
Set Mailer = Nothing
set MailerConfig = nothing
email = true
end function
Inquiry.asp page call from inquiry.html with method="post"
Inquiry.asp page code
<%
message=""
message=message & "Name : " & Request.Form("txtName") & vbcrlf
message=message & "Designation : " & Request.Form("txtDesignation") & vbcrlf
message=message & "Organization : " & Request.Form("txtOrganization") & vbcrlf
message=message & "Address : " & Request.Form("txtAddress") & vbcrlf
message=message & "City : " & Request.Form("txtCity") & vbcrlf
message=message & "State : " & Request.Form("txtState") & vbcrlf
message=message & "Country : " & Request.Form("cmbCountry") & vbcrlf
message=message & "Phone : " & Request.Form("txtPhone") & vbcrlf
message=message & "Email : " & Request.Form("txtEmail") & vbcrlf
message=message & "Fax : " & Request.Form("txtFax") & vbcrlf
message=message & "Category : " & Request.Form("cmbCategory") & vbcrlf
message=message & "Query : " & Request.Form("txtQuery") & vbcrlf
message=message & "Product of Interest : " & Request.Form("txtgpo") & vbcrlf
message=message & "Product of Interest : " & Request.Form("txtgta") & vbcrlf
message=message & "Product of Interest : " & Request.Form("txtgpu") & vbcrlf
message=message & "Product of Interest : " & Request.Form("txtsw") & vbcrlf
message=message '& "**********************************************************"
set objmail=server.createobject("CDONTS.NewMail")
objmail.bodyformat = 0
objmail.to = "info#ankurscientific.com"
objmail.To = "abc#gmail.com"
'objmail.From = Request.Form("txtemail")
objmail.From = "info#domain.com"
objmail.Subject="Enquiry"
objmail.BodyFormat = 1
objmail.Body=message
objmail.Send
set objmail=nothing
%>
I getting error: '80070003'
/sendmail.asp, line no:xx
This is an explanation and solution to your problem: http://support.microsoft.com/kb/238956