asp classic - How to add the email sending script -


i'm new vbscript. have make form uploading file , sending specified email attachment. uploading used script http://www.freeaspupload.net/freeaspupload/viewsource.asp application saves file server. second part looks this:

<% option explicit  if request.cookies("quoterequest") = "quote"     dim filename     dim strmsg     dim mail     dim strsubject     dim strfrom     dim strreply     dim strchoice     dim addcheck     dim mycheckdate     dim strmailblindcopy      dim smtpserver     dim youremail     dim public_mailer     dim public_password      smtpserver = ""     youremail = ""     public_mailer = ""        public_password = ""      addcheck = request.form("str_xxrand234myanswer")     'use next line if want blind copy send records     'strmailblindcopy   = "info@ciupac.com"       'if addcheck = "" or null     if len(addcheck)>2 or len(addcheck)<1 or isnumeric(addcheck)=false           response.write "<a href=""javascript:history.back()""><h2>sorry error has occurred, please click here return form</h2></a>" & addcheck        else          dim objsendmail         set objsendmail = createobject("cdo.message")           'this section provides configuration information remote smtp server.          objsendmail.configuration.fields.item ("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2 'send message using network (smtp on network).         objsendmail.configuration.fields.item ("http://schemas.microsoft.com/cdo/configuration/smtpserver") = smtpserver         objsendmail.configuration.fields.item ("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25          objsendmail.configuration.fields.item ("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = false 'use ssl connection (true or false)         objsendmail.configuration.fields.item ("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 60          ' if server requires outgoing authentication uncomment lines bleow , use valid email address , password.         objsendmail.configuration.fields.item ("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1 'basic (clear-text) authentication         objsendmail.configuration.fields.item ("http://schemas.microsoft.com/cdo/configuration/sendusername") = public_mailer         objsendmail.configuration.fields.item ("http://schemas.microsoft.com/cdo/configuration/sendpassword") = public_password          objsendmail.configuration.fields.update          strfrom             = "quote request form"         strreply            = request.form("txtemail")          strsubject = "quote request form"           strmsg = strmsg & "<b>your name:</b> " & request.form("txtname") & vbcrlf & vbcrlf & "<br>" & "<br>"             strmsg = strmsg & "<b>your company name:</b> " & request.form("txtcompany") & vbcrlf & vbcrlf & "<br>" & "<br>"          strmsg = strmsg & "<b>your order number:</b> " & request.form("txtyourorder") & vbcrlf & vbcrlf & "<br>" & "<br>"            strmsg = strmsg & "<b>our order number:</b> " & request.form("txtourorder") & vbcrlf & vbcrlf & "<br>"   & "<br>"                strmsg = strmsg & "<b>destination postal code:</b> " & request.form("txtpostal") & vbcrlf & vbcrlf & "<br>"  & "<br>"                        strmsg = strmsg & "<b>order date:</b> " & request.form("txtdate") & vbcrlf & vbcrlf & "<br>"         & "<br>"                            strmsg = strmsg & "<b>your e-mail address:</b> " & request.form("txtemail") & vbcrlf & vbcrlf & "<br>" & "<br>"          strmsg = strmsg & "<b>telephone #:</b> " & request.form("txtphone") & vbcrlf & vbcrlf & "<br>" & "<br>"          strmsg = strmsg & "<b>comments:</b> " & request.form("txtcomments") & vbcrlf & vbcrlf & "<br>" & "<br>"         strmsg = strmsg & "<b>market served:</b> " & request.form("option1") & ", " & request.form("option2") & ", " & request.form("option3") & ", " & request.form("option4") & ", " & request.form("option5") & ", " & request.form("option6") & ", " & request.form("option7") & ", " & request.form("option8") & ", " & request.form("option9") & ", " & request.form("option10") & ", " & request.form("option11") & ", " & request.form("option12") & ", " & request.form("option13") & ", " & request.form("option14") & vbcrlf & vbcrlf & "<br>" & "<br>"         strmsg = strmsg & "<b>topic of interest:</b> " & request.form("option15") & ", " & request.form("option16") & ", " & request.form("option17") & ", " & request.form("option18") & ", " & request.form("option19") & ", " & request.form("option20") & ", " & request.form("option21") & ", " & request.form("option22") & ", " & request.form("option23") & ", " & request.form("option24") & ", " & request.form("option25") & ", " & request.form("option26") & ", " & request.form("option27") & ", " & request.form("option28") & ", " & request.form("option29") & ", " & request.form("option30") & ", " & request.form("option31") & ", " & request.form("option32") & vbcrlf & vbcrlf          filename = request.form("file")           dim strmailto          strmailto =""         objsendmail.to = strmailto         objsendmail.subject = strsubject         objsendmail.from = strreply         objsendmail.htmlbody = strmsg         if len(filename)then             objsendmail.addattachment "c:\attachments\" & filename          end if         objsendmail.send         set objsendmail = nothing                response.redirect("thank-you.asp")     end if else     dim txtname     response.write "error <p>"     fname=request.cookies("quoterequest")     response.write("quoterequest=" & txtname)  end if  %> 

these 2 scripts work independently, when try include email send part upload cannot use request.form collection after calling binaryread error appears. how need call email sender?

due special enctype="multipart/form-data" attribute of form, cannot use reqest.form collection. use upload.form instead, after call upload.save (savevirtual, savetomemory).


Comments

Popular posts from this blog

c++ - Creating new partition disk winapi -

Android Prevent Bluetooth Pairing Dialog -

VBA function to include CDATA -